331 lines
11 KiB
C#
331 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using SOH.Entities;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SaleSettings;
|
|
using SOH.Window;
|
|
|
|
namespace SOH.SaleSettings
|
|
{
|
|
public partial class frmKeHuDingDanCZ : VerificationForm
|
|
{
|
|
int ddbm;//操作成功后保存主键
|
|
int ddtjsh = 0;
|
|
public frmKeHuDingDanCZ(int khbm, frmKeHuZiLiaoCz c)
|
|
{
|
|
InitializeComponent();
|
|
this.zt = 1;
|
|
this.khbm = khbm;
|
|
this.cz = c;
|
|
}
|
|
ts_dd o;
|
|
int zt;//0修改1添加
|
|
int khbm;
|
|
frmKeHuZiLiaoCz cz;
|
|
public frmKeHuDingDanCZ(ts_dd o, frmKeHuZiLiaoCz c)
|
|
{
|
|
this.o = o;
|
|
this.zt = 0;
|
|
this.khbm = o.khbm;
|
|
this.cz = c;
|
|
ddbm = o.ddbm;
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void frmKeHuDingDanCZ_Load(object sender, EventArgs e)
|
|
{
|
|
ddtjsh = 0;
|
|
cbbjsfs.SelectedIndex = 0;
|
|
cbbddlb.SelectedIndex = 0;
|
|
var service = ServiceContainer.GetService<Its_khlxr>();
|
|
cbblxr.DataSource = service.GetlxrBykhbm(khbm);
|
|
cbblxr.DisplayMember = "xm";
|
|
cbblxr.ValueMember = "lxrbm";
|
|
this.cbbnd.Text = DateTime.Now.Year.ToString();
|
|
if (zt == 0)
|
|
{
|
|
|
|
var service1 = ServiceContainer.GetService<Its_ddfzb>();
|
|
tsddfzbBindingSource.DataSource = service1.GetddfzbByddbm(o.ddbm);
|
|
|
|
|
|
cbblxr.SelectedValue = o.lxrbm;
|
|
|
|
tbbzh.Text = o.bzh;
|
|
chbcjfw.Checked = (o.cjfw == 0) ? false : true;
|
|
dtpcncbrq.Text = o.cncbrq.ToString();
|
|
tbcwshczy.Text = o.cwshczy;
|
|
tbcwshtg.Text = (o.cwshtg == 0) ? "不通过" : "通过";
|
|
tbcwshyj.Text = o.cwshyj;
|
|
tbcxyy.Text = o.cxyy;
|
|
tbddbj.Text = o.ddbj;
|
|
cbbddlb.SelectedIndex = o.ddlb;
|
|
|
|
switch (o.ddzt)
|
|
{
|
|
case 0:
|
|
tbddzt.Text = "新建订单";
|
|
break;
|
|
case 1:
|
|
tbddzt.Text = "待审核";
|
|
break;
|
|
case 2:
|
|
tbddzt.Text = "审核完成";
|
|
break;
|
|
case 3:
|
|
tbddzt.Text = "财务审核结束";
|
|
break;
|
|
case 4:
|
|
tbddzt.Text = "已生成合同";
|
|
break;
|
|
}
|
|
cbbjsfs.SelectedIndex = o.jsfs;
|
|
dtpjzrq.Text = o.jzrq.ToString();
|
|
dtpjsrq.Text = o.jsrq.ToString();
|
|
tblednr.Text = o.lednr;
|
|
chblrt.Checked = (o.lrt == 0) ? false : true;
|
|
chbzcyy.Checked = (o.zcyy == 0) ? false : true;
|
|
cbbnd.Text = o.nd.ToString();
|
|
dtpqsrq.Text = o.qsrq.ToString();
|
|
tbxsshczy.Text = o.xsshczy;
|
|
tbxsshtg.Text = (o.xsshtg == 0) ? "不通过" : "通过";
|
|
tbxsshyj.Text = o.xsshyj;
|
|
tbyjje.Text = (o.yjje / 100).ToString("#.##");
|
|
tbyjrs.Text = o.yjtjrs.ToString();
|
|
chbzcfw.Checked = (o.zcfw == 0) ? false : true;
|
|
dtpzkrq.Text = o.zkrq.ToString();
|
|
}
|
|
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
if (!check())
|
|
{
|
|
return ;
|
|
}
|
|
|
|
var service1 = ServiceContainer.GetService<Its_dd>();
|
|
if (zt == 0)
|
|
{
|
|
//if (o.ddzt == 4)
|
|
//{
|
|
// MessageBox.Show("此订单已生成合同!不允许修改。");
|
|
// return;
|
|
//}
|
|
|
|
ts_dd o1 = service1.GetListByddbm(o.ddbm)[0];
|
|
o1.lxrbm = Convert.ToInt32(cbblxr.SelectedValue);
|
|
o1.bzh = tbbzh.Text;
|
|
o1.cjfw = Convert.ToInt16(chbcjfw.Checked);
|
|
o1.cncbrq = Convert.ToDateTime(dtpcncbrq.Text);
|
|
o1.cxyy = tbcxyy.Text;
|
|
o1.ddbj = tbddbj.Text;
|
|
o1.ddlb = Convert.ToInt16(cbbddlb.SelectedIndex);
|
|
o1.jsfs = Convert.ToInt16(cbbjsfs.SelectedIndex);
|
|
o1.jzrq = Convert.ToDateTime(dtpjzrq.Text);
|
|
o1.jsrq = Convert.ToDateTime(dtpjsrq.Text);
|
|
o1.lednr = tblednr.Text;
|
|
o1.lrt = Convert.ToInt16(chblrt.Checked);
|
|
o1.zcyy = Convert.ToInt16(chbzcyy.Checked);
|
|
o1.pahzdw = Convert.ToInt16(panhzdw.Checked);
|
|
o1.nd = Convert.ToInt16(cbbnd.Text);
|
|
o1.qsrq = Convert.ToDateTime(dtpqsrq.Text);
|
|
o1.yjje = Convert.ToInt32(Convert.ToDecimal(tbyjje.Text) * 100);
|
|
o1.yjtjrs = Convert.ToInt16(tbyjrs.Text);
|
|
o1.zcfw = Convert.ToInt16(chbzcfw.Checked);
|
|
o1.zkrq = Convert.ToDateTime(dtpzkrq.Text);
|
|
o1.xsczy = LoginUser.username;
|
|
o1.fddm =Convert.ToInt16(LoginUser.yydm);
|
|
MessageBox.Show(service1.Updatedd(o1).Message);
|
|
this.o = o1;
|
|
ddbm = o1.ddbm;
|
|
}
|
|
else
|
|
{
|
|
ts_dd o1 = new ts_dd();
|
|
o1.ddbm = ServiceContainer.GetService<IBasic>().GetMax(o1.DbTableName, -1);
|
|
o1.ddbm = o1.ddbm;
|
|
o1.khbm = khbm;
|
|
o1.lxrbm = Convert.ToInt32(cbblxr.SelectedValue);
|
|
o1.bzh = tbbzh.Text;
|
|
o1.cjfw = Convert.ToInt16(chbcjfw.Checked);
|
|
o1.cncbrq = Convert.ToDateTime(dtpcncbrq.Text);
|
|
o1.cxyy = tbcxyy.Text;
|
|
o1.ddbj = tbddbj.Text;
|
|
o1.ddlb = Convert.ToInt16(cbbddlb.SelectedIndex);
|
|
o1.jsfs = Convert.ToInt16(cbbjsfs.SelectedIndex);
|
|
o1.jzrq = Convert.ToDateTime(dtpjzrq.Text);
|
|
o1.jsrq = Convert.ToDateTime(dtpjsrq.Text);
|
|
o1.lednr = tblednr.Text;
|
|
o1.lrt = Convert.ToInt16(chblrt.Checked);
|
|
o1.zcyy= Convert.ToInt16(chbzcyy.Checked);
|
|
o1.nd = Convert.ToInt16(cbbnd.Text);
|
|
o1.qsrq = Convert.ToDateTime(dtpqsrq.Text);
|
|
o1.yjje = Convert.ToInt32(Convert.ToDecimal(tbyjje.Text) * 100);
|
|
o1.yjtjrs = Convert.ToInt16(tbyjrs.Text);
|
|
o1.zcfw = Convert.ToInt16(chbzcfw.Checked);
|
|
o1.zkrq = Convert.ToDateTime(dtpzkrq.Text);
|
|
o1.ddzt = 0;
|
|
o1.xsshtg = 0;
|
|
o1.cwshtg = 0;
|
|
o1.fddm = Convert.ToInt16(LoginUser.yydm);
|
|
o1.xsczy = LoginUser.username;
|
|
MessageBox.Show(service1.Insertdd(o1).Message);
|
|
ddbm = o1.ddbm;
|
|
this.o = o1;
|
|
this.khbm = o1.khbm;
|
|
this.ddbm = o1.ddbm;
|
|
}
|
|
cz.frmKeHuZiLiaoCz_Load(sender, e);
|
|
//this.Close();
|
|
this.zt = 0;
|
|
frmKeHuDingDanCZ_Load(null,null);
|
|
|
|
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (dataGridView2.CurrentRow.Index < 0)
|
|
{
|
|
return;
|
|
}
|
|
ts_ddfzb o = dataGridView2.Rows[dataGridView2.CurrentRow.Index].DataBoundItem as ts_ddfzb;
|
|
frmKeHuDingDanFenZuCZ cz = new frmKeHuDingDanFenZuCZ(o, 0, this);
|
|
|
|
cz.ShowDialog();
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
if (o != null)
|
|
{
|
|
frmKeHuDingDanFenZuCZ cz = new frmKeHuDingDanFenZuCZ(o.ddbm, this);
|
|
cz.ShowDialog();
|
|
}
|
|
else MessageBox.Show("请创建订单后再添加套餐分组!");
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView2.CurrentRow.Index < 0)
|
|
{
|
|
return;
|
|
}
|
|
if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
ts_ddfzb o = dataGridView2.Rows[dataGridView2.CurrentRow.Index].DataBoundItem as ts_ddfzb;
|
|
MessageBox.Show(ServiceContainer.GetService<Its_ddfzb>().Deldd(o).Message);
|
|
tsddfzbBindingSource.Remove(o);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void tbyjrs_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
base.m_textBox_KeyPress(sender, e);
|
|
}
|
|
|
|
private void tbyjrs_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
base.m_textBox_KeyDown(sender, e);
|
|
}
|
|
|
|
private void tbyjje_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
base.m_textBox_KeyDown(sender, e);
|
|
}
|
|
|
|
private void tbyjje_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
base.m_textBox_KeyPress(sender, e);
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView2.Rows.Count == 0)
|
|
{
|
|
MessageBox.Show("创建分组后再提交审核!");
|
|
return;
|
|
}
|
|
var s = ServiceContainer.GetService<Its_dd>();
|
|
ts_dd dd = s.GetListByddbm(ddbm)[0];
|
|
//if (dd.ddzt == 0 || dd.ddzt==4)
|
|
if (1==1)
|
|
{
|
|
dd.ddzt = 1;
|
|
//MessageBox.Show((s.Updatedd(dd).State == 1) ? "提交审核成功!" : "提交审核失败,请联系管理员。");
|
|
if (s.Updatedd(dd).State == 1)
|
|
{
|
|
MessageBox.Show("提交审核成功!");
|
|
ddtjsh = 1;
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("提交审核失败,请联系管理员。");
|
|
ddtjsh = 2;
|
|
}
|
|
cz.frmKeHuZiLiaoCz_Load(sender, e);
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("该订单状态已经审核或已失效!");
|
|
}
|
|
}
|
|
public bool check()
|
|
{
|
|
if (tbddbj.Text == "")
|
|
{
|
|
MessageBox.Show("订单标示不能为空!");
|
|
return false;
|
|
}
|
|
if (tbyjrs.Text == "")
|
|
{
|
|
MessageBox.Show("预计人数不能为空!");
|
|
return false;
|
|
}
|
|
if (tbyjje.Text == "")
|
|
{
|
|
MessageBox.Show("预计金额不能为空!");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
button4_Click(null, null);
|
|
}
|
|
|
|
private void frmKeHuDingDanCZ_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
if (ddtjsh == 0)
|
|
{
|
|
DialogResult result;
|
|
result = MessageBox.Show("订单没有提交审核,确定退出吗?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
if (result == DialogResult.OK)
|
|
{
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|