private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } DataRow dr = this.dgvItem.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IItem bll = new BLL.ItemBLL(); var item = DB.ReflectionHelper.DataRowToModel <bi_t_item_info>(dr); bll.Del(item); LoadItem(); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (sheet_no != null && sheet_no != "") { if (YesNoForm.ShowFrom("确认删除单据[" + sheet_no + "]?") == System.Windows.Forms.DialogResult.Yes) { IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.DeleteInOut(sheet_no, update_time); IOrder ins = this; ins.Add(); } } } catch (Exception ex) { MsgForm.ShowFrom("删除单据异常[" + ex.Message + "]"); Helper.LogHelper.writeLog("frmOtherInOutSheet->tsbDel_Click()", ex.ToString(), sheet_no); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (this.dataGrid1.CurrentRow() != null) { string sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICusSettle bll = new BLL.CusSettle(); bll.Delete(sheet_no); var tb = this.dataGrid1.DataSource; tb.Rows.Remove(this.dataGrid1.CurrentRow()); this.dataGrid2.DataSource = new DataTable(); this.dataGrid1.Refresh(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (txtsheet_no.Text.Trim() != "") { string sheet_no = txtsheet_no.Text.Trim(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICashOrder bll = new BLL.CashOrder(); bll.Delete(sheet_no); IOrder ins = this; ins.Add(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbUpload_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "14")) { return; } if (this.dgv.CurrentRow() != null) { if (order.IsEdit() == true) { var res = YesNoForm.ShowFrom("数据已修改,是否保存?"); if (res == DialogResult.Yes) { order.Save(); order.ShowOrder(this.dgv.CurrentRow()["sheet_no"].ToString()); ordermerge.ShowForm2(); } else if (res == DialogResult.No) { order.ShowOrder(this.dgv.CurrentRow()["sheet_no"].ToString()); ordermerge.ShowForm2(); } else if (res == DialogResult.Cancel) { } } else { order.ShowOrder(this.dgv.CurrentRow()["sheet_no"].ToString()); ordermerge.ShowForm2(); } } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } DataRow dr = this.dgvSup.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { if (_runType == 0) { IBLL.ISup bll = new BLL.SupBLL(); var sup = DB.ReflectionHelper.DataRowToModel <bi_t_supcust_info>(dr); bll.Del(sup); } else if (_runType == 1) { IBLL.ICus bll = new BLL.CusBLL(); var sup = DB.ReflectionHelper.DataRowToModel <bi_t_supcust_info>(dr); bll.Del(sup); } LoadSup(); } }
private void btnDel_Click(object sender, EventArgs e) { try { if (this.dataGrid1.CurrentRow() == null) { return; } if ("1".Equals(this.dataGrid1.CurrentRow()["is_base"].ToString())) { MsgForm.ShowFrom("系统样式不可删除"); return; } if (YesNoForm.ShowFrom("确认要删除样式[" + this.dataGrid1.CurrentRow()["style_name"] + "]") == DialogResult.Yes) { IBLL.IPrint bll = new BLL.PrintBLL(); PrintHelper.DelStyle(this.dataGrid1.CurrentRow()["style_id"].ToString()); bll.Del(new sys_t_print_style() { style_id = this.dataGrid1.CurrentRow()["style_id"].ToString(), update_time = DateTime.Now }); Flush(); } } catch (Exception exception) { MsgForm.ShowFrom(exception); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (this.dataGrid1.CurrentRow() != null) { string sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.DeleteInOut(sheet_no, update_time); var tb = this.dataGrid1.DataSource; tb.Rows.Remove(this.dataGrid1.CurrentRow()); this.dataGrid2.DataSource = new DataTable(); this.dataGrid1.Refresh(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmIOMaster->tsbDel_Click()", ex.ToString()); } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } DataRow dr = this.dgvPay.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IFinanceBLL bll = new BLL.FinanceBLL(); var item = DB.ReflectionHelper.DataRowToModel <bi_t_sz_type>(dr); if (item != null) { try { bll.DeleteSZType(item.pay_way); init_data(); } catch (Exception ex) { MsgForm.ShowFrom("删除收支类型异常[" + ex.Message + "]"); } } } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } DataRow dr = this.dgvPay.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IPayment bll = new BLL.PaymentBLL(); var item = DB.ReflectionHelper.DataRowToModel <bi_t_payment_info>(dr); if (item.pay_flag.Equals("1")) { MsgForm.ShowFrom("系统预留方式不可删除"); return; } bll.Del(item); LoadPay(); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (tvRegion.SelectedNode != null) { if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IDept bll = new BLL.DeptBLL(); bll.Del(tvRegion.SelectedNode.Tag as bi_t_dept_info); tvRegion.SelectedNode.Remove(); } } } catch (Exception ex) { LogHelper.writeLog("frmDept=>Del", ex.ToString()); MsgForm.ShowFrom(ex); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // DataRow dr = this.dgvBank.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IBank bll = new BLL.BankBLL(); var bank = DB.ReflectionHelper.DataRowToModel <bi_t_bank_info>(dr); bll.Del(bank); LoadBank(); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (this.dgv.CurrentRow() != null) { string sheet_no = this.dgv.CurrentRow()["sheet_no"].ToString(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.DeleteChectInitSheet(new Model.ic_t_check_init() { sheet_no = sheet_no, update_time = DateTime.Now }); var tb = this.dgv.DataSource; tb.Rows.Remove(this.dgv.CurrentRow()); this.dgv.Refresh(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void btnLogout_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "14")) { return; } if (this.dgv.SelectedRows.Count < 1) { return; } if (YesNoForm.ShowFrom("确认要注销机号吗?") == DialogResult.Yes) { Model.netsetup ns = new Model.netsetup() { jh = dgv.CurrentRow.Cells["机号"].Value.ToString(), ip = dgv.CurrentRow.Cells["Ip地址"].Value.ToString(), softpos = dgv.CurrentRow.Cells["机号类型"].Value.ToString(), }; bll.DelJH(ns); LoadDGV(); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbInI_Click(object sender, EventArgs e) { //初始化 if (YesNoForm.ShowFrom("确认要初始化吗?") == DialogResult.Yes) { InI(); } }
private void txt_voucher_no_TextChanged(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.txt_voucher_no.Text)) { return; } IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.GetInOut(this.txt_voucher_no.Text, "A", out in_master, out in_detail); if (in_detail.Rows.Count > 0) { var tb = editGrid1.DataSource; if (tb.Rows.Count > 0) { if (YesNoForm.ShowFrom("检测到表格中有数据,是否加载?(将覆盖数据)") == DialogResult.Yes) { tb.Clear(); } } foreach (DataRow dr in in_detail.Rows) { DataRow r = tb.NewRow(); r["item_no"] = dr["item_no"]; r["item_subno"] = dr["item_subno"]; r["item_name"] = dr["item_name"]; r["unit_no"] = dr["unit_no"]; r["item_size"] = dr["item_size"]; r["in_qty"] = dr["in_qty"]; r["valid_price"] = dr["valid_price"]; r["sub_amount"] = dr["sub_amount"]; r["other1"] = dr["other1"]; r["price"] = dr["price"]; tb.Rows.Add(r); } editGrid1.Refresh(); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void txt_voucher_no_TextChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_voucher_no.Text)) { return; } IBLL.IInOutBLL bll = new BLL.InOutBLL(); DataTable tb1; DataTable tb2; bll.GetSaleSheet(txt_voucher_no.Text, out tb1, out tb2); if (tb2.Rows.Count > 0) { var tb = editGrid1.DataSource; if (tb.Rows.Count > 0) { if (YesNoForm.ShowFrom("检测到表格中有数据,是否加载?(将覆盖数据)") == DialogResult.Yes) { tb.Clear(); } } foreach (DataRow dr in tb2.Rows) { DataRow r = tb.NewRow(); r["item_no"] = dr["item_no"]; r["item_subno"] = dr["item_subno"]; r["item_name"] = dr["item_name"]; r["unit_no"] = dr["unit_no"]; r["item_size"] = dr["item_size"]; r["in_qty"] = dr["sale_qnty"]; r["valid_price"] = dr["real_price"]; r["sub_amount"] = dr["sale_money"]; r["other1"] = dr["other1"]; r["price"] = dr["sale_price"]; tb.Rows.Add(r); } editGrid1.Refresh(); } }
private void tsbDel_Click(object sender, EventArgs e) { try { DataGridViewRow row = this.dgv.CurrentRow; if (row == null) { return; } if (YesNoForm.ShowFrom("确认要删除该行吗?") == DialogResult.Yes) { this.dgv.Rows.RemoveAt(row.Index); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbEdit_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "14")) { return; } if (this.dataGrid1.CurrentRow() != null) { if (order.IsEdit() == true) { var res = YesNoForm.ShowFrom("数据已修改,是否保存?"); if (res == DialogResult.Yes) { order.Save(); order.ShowOrder(this.dataGrid1.CurrentRow()["sheet_no"].ToString()); ordermerge.ShowForm2(); } else if (res == DialogResult.No) { order.ShowOrder(this.dataGrid1.CurrentRow()["sheet_no"].ToString()); ordermerge.ShowForm2(); } else if (res == DialogResult.Cancel) { } } else { order.ShowOrder(this.dataGrid1.CurrentRow()["sheet_no"].ToString()); ordermerge.ShowForm2(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmIOMaster->tsbEdit_Click()", ex.ToString()); } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } DataRow dr = this.dgvPeo.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IPeople bll = new BLL.PeopleBLL(); var peo = DB.ReflectionHelper.DataRowToModel <bi_t_people_info>(dr); bll.Del(peo); LoadPeo(); } }
private void tsbDelType_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IOper bll = new BLL.OperBLL(); bll.DelOperType((sa_t_oper_type)this.tv.SelectedNode.Tag); LoadTv(); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } DataRow dr = this.dgvOper.CurrentRow(); if (dr == null) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IOper bll = new BLL.OperBLL(); var b = DB.ReflectionHelper.DataRowToModel <sa_t_operator_i>(dr); bll.Del(b.oper_id); tv_AfterSelect(null, null); } }
private void tsbAdd_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "01")) { return; } if (order.IsEdit() == true) { var res = YesNoForm.ShowFrom("数据已修改,是否保存?"); if (res == DialogResult.Yes) { order.Save(); order.Add(); ordermerge.ShowForm2(); } else if (res == DialogResult.No) { order.Add(); ordermerge.ShowForm2(); } else if (res == DialogResult.Cancel) { } } else { order.Add(); ordermerge.ShowForm2(); } } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCGInSheetList->tsbAdd_Click()", ex.ToString()); } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (string.IsNullOrEmpty(this.txtSheet_no.Text)) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.DeleteChectInitSheet(new ic_t_check_init() { sheet_no = this.txtSheet_no.Text, update_time = DateTime.Now }); IOrder order = this; order.Add(); } }
private void tsbIniPwd_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "14")) { return; } if (this.dgvOper.CurrentRow() == null) { return; } sa_t_operator_i oper = DB.ReflectionHelper.DataRowToModel <sa_t_operator_i>(dgvOper.CurrentRow()); if (YesNoForm.ShowFrom("确认要重置操作员:" + oper.oper_name + "的密码吗?") == DialogResult.Yes) { IBLL.IOper bll = new BLL.OperBLL(); bll.ResetPWD(oper.oper_id, "1234"); MsgForm.ShowFrom("重置完成,默认密码:1234"); LoadOper(); tv_AfterSelect(null, null); } }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txt_trans_no.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("业务类型必填!"); return; } if (txtbranch.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("机构必填!"); return; } if (txtoper_date.Text.Trim() == "") { MsgForm.ShowFrom("单据日期必填!"); return; } ic_t_inout_store_master ord = new ic_t_inout_store_master(); List <ic_t_inout_store_detail> lines = new List <ic_t_inout_store_detail>(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.trans_no = txt_trans_no.Text.Trim().Split('/')[0]; ord.branch_no = txtbranch.Text.Trim().Split('/')[0]; ord.voucher_no = ""; ord.supcust_no = ""; ord.pay_way = ""; ord.discount = 1; ord.coin_no = "RMB"; ord.tax_amount = 0; ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text.Trim()); ord.oper_id = txtoper_man.Text.Split('/')[0]; ord.deal_man = txt_deal_man.Text.Split('/')[0]; ord.cm_branch = "00"; ord.other1 = txt_other3.Text.Trim(); ord.other2 = ""; ord.other3 = txt_other3.Text.Trim(); ord.old_no = txt_old_no.Text; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; ord.sale_no = ""; ord.approve_flag = "0"; ord.approve_man = txtapprove_man.Text.Split('/')[0]; ord.approve_date = System.DateTime.MinValue; ord.pay_date = System.DateTime.MinValue; ord.update_time = update_time; int flag = 0; int index = 0; decimal total_amt = 0; foreach (DataRow row in editGrid1.DataSource.Rows) { ++index; if (row["item_no"].ToString() != "") { ic_t_inout_store_detail line = new ic_t_inout_store_detail(); lines.Add(line); line.sheet_no = ord.sheet_no; line.item_no = row["item_no"].ToString(); line.item_name = row["item_name"].ToString(); line.unit_no = row["unit_no"].ToString(); line.barcode = row["barcode"].ToString(); line.unit_factor = 1; line.in_qty = Helper.Conv.ToDecimal(row["in_qty"].ToString()); line.orgi_price = 0; line.valid_price = Helper.Conv.ToDecimal(row["valid_price"].ToString()); line.cost_price = 0; line.sub_amount = Helper.Conv.ToDecimal(row["sub_amount"].ToString()); line.discount = 1; line.tax = 0; line.is_tax = "0"; line.valid_date = DateTime.MinValue; line.other1 = row["other1"].ToString(); line.other2 = ""; line.other3 = ""; line.voucher_no = ""; line.sheet_sort = index; line.ret_qnty = 0; line.num1 = 0; line.num2 = 0; line.num3 = 0; line.num4 = 0; line.num5 = 0; line.num6 = 0; line.cost_notax = 0; line.packqty = 0; line.sgqty = 0; flag = 1; total_amt += line.in_qty * line.valid_price; } } if (flag == 0) { MsgForm.ShowFrom("请输入表单明细"); return; } ord.inout_amount = total_amt; ord.total_amount = total_amt; IBLL.IInOutBLL bll = new BLL.InOutBLL(); if (runType == 1) { var sheet_no = ""; bll.AddInOut(ord, lines, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { bll.ChangeInOut(ord, lines); IOrder ins = this; ins.ShowOrder(ord.sheet_no); } Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); IBLL.ISys sys = new BLL.SysBLL(); string isApprove = sys.Read("approve_at_ones"); if ("1".Equals(isApprove)) { if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes) { tsbCheck_Click(new object(), new EventArgs()); } } } catch (Exception ex) { Helper.LogHelper.writeLog("frmOtherInOutSheet->Save()", ex.ToString(), txtsheet_no.Text); MsgForm.ShowFrom("其它出入单保存异常[" + ex.Message + "]"); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txtpay_way.Text.Trim().Contains("/") == false) { throw new Exception("付款方式必填!"); } if (txtbranch.Text.Trim().Contains("/") == false) { throw new Exception("机构必填!"); } if (txtoper_date.Text.Trim() == "") { throw new Exception("单据日期必填!"); } if (this.txtvisa.Text.Trim().Contains("/") == false) { throw new Exception("转出账户必填!"); } if (this.txtvisa2.Text.Trim().Contains("/") == false) { throw new Exception("转入账户必填!"); } if (Helper.Conv.ToDecimal(txtcash.Text.Trim()) <= 0) { throw new Exception("转账金额不正确!"); } Model.bank_t_cash_master ord = new Model.bank_t_cash_master(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.branch_no = txtbranch.Text.Trim().Split('/')[0]; ord.voucher_no = txtold_no.Text.Trim(); ord.visa_id = txtvisa.Text.Trim().Split('/')[0]; ord.visa_in = txtvisa2.Text.Trim().Split('/')[0]; ord.pay_way = txtpay_way.Text.Split('/')[0]; ord.coin_no = "RMB"; ord.coin_rate = 1; ord.deal_man = txtpeople.Text.Trim().Split('/')[0]; ord.oper_id = txtoper_man.Text.Trim().Split('/')[0]; ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text); ord.bill_total = Helper.Conv.ToDecimal(txtcash.Text.Trim()); ord.bill_flag = "B"; ord.cm_branch = "00"; ord.approve_flag = "0"; ord.approve_man = ""; ord.approve_date = System.DateTime.MinValue; ord.other1 = txtmemo.Text.Trim(); ord.other2 = ""; ord.other3 = ""; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; if (runType == 1) { IBLL.ICashOrder bll = new BLL.CashOrder(); string sheet_no = ""; bll.Add(ord, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { IBLL.ICashOrder bll = new BLL.CashOrder(); bll.Change(ord); IOrder ins = this; ins.ShowOrder(ord.sheet_no); } Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Conv.ControlsAdds(this, dic); IBLL.ISys sys = new BLL.SysBLL(); string isApprove = sys.Read("approve_at_ones"); if ("1".Equals(isApprove)) { if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes) { tsbCheck_Click(new object(), new EventArgs()); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
private void myButton1_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.txtsup.Text)) { return; } if (!string.IsNullOrEmpty(this.txtsheet_no.Text)) { return; } if (this.editGrid1.DataSource.Rows.Count > 0) { if (YesNoForm.ShowFrom("表格中有数据,确认要清空覆盖吗?") == DialogResult.Yes) { this.editGrid1.DataSource.Rows.Clear(); } else { return; } } string sup = this.txtsup.Text.Trim().Split('/')[0]; System.Threading.Thread th = new System.Threading.Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICusSettle bll = new BLL.CusSettle(); var tb = bll.GetAccountFlows(new Model.rp_t_accout_payrec_flow() { supcust_no = sup, supcust_flag = "S" }); this.Invoke((MethodInvoker) delegate { foreach (DataRow dr in tb.Rows) { var r = this.editGrid1.DataSource.NewRow(); r["select_flag"] = "1"; r["path"] = dr["pay_type"]; r["voucher_no"] = dr["voucher_no"]; r["voucher_first"] = dr["trans_no"]; r["sheet_amount"] = dr["sheet_amount"]; r["pay_date"] = dr["pay_date"]; r["paid_amount"] = Conv.ToDecimal(dr["已付金额"]); r["paid_free"] = Conv.ToDecimal(dr["已免付金额"]); r["yf_amount"] = Conv.ToDecimal(dr["sheet_amount"]) - Conv.ToDecimal(dr["已免付金额"]) - Conv.ToDecimal(dr["已付金额"]); r["pay_free"] = 0.00; r["memo"] = dr["memo"]; r["pay_amount"] = Conv.ToDecimal(r["yf_amount"]); this.editGrid1.DataSource.Rows.Add(r); } var pay_amount = this.editGrid1.DataSource.AsEnumerable().Sum((r) => { int path = 1; if (r.Field <object>("path").ToString().Equals("-") || r.Field <object>("path").ToString().Equals("-1")) { path = -1; } return(Conv.ToDecimal(r.Field <object>("pay_amount")) * path); }); this.txttotal_amount.Text = pay_amount.ToString("0.00"); pay_amount = this.editGrid1.DataSource.AsEnumerable().Sum((r) => { int path = 1; if (r.Field <object>("path").ToString().Equals("-") || r.Field <object>("path").ToString().Equals("-1")) { path = -1; } return(Conv.ToDecimal(r.Field <object>("pay_free")) * path); }); this.txtfree_money.Text = pay_amount.ToString("0.00"); this.editGrid1.DataSource = this.editGrid1.DataSource; this.editGrid1.Refresh(); }); } catch (Exception ex) { IvyBack.Helper.LogHelper.writeLog("myButton1_Click", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txtsup.Text.Trim().Contains("/") == false) { throw new Exception("货商必填!"); } if (txtbranch.Text.Trim().Contains("/") == false) { throw new Exception("机构必填!"); } if (txtoper_date.Text.Trim() == "") { throw new Exception("单据日期必填!"); } if (txtpay_way.Text.Trim().Contains("/") == false) { throw new Exception("付款方式必填"); } if (txtvisa.Text.Trim().Contains("/") == false) { throw new Exception("账户必填"); } Model.rp_t_recpay_record_info ord = new Model.rp_t_recpay_record_info(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.supcust_no = txtsup.Text.Split('/')[0]; ord.supcust_flag = "S"; ord.flag_post = "1"; ord.total_amount = Helper.Conv.ToDecimal(txttotal_amount.Text.Trim()); ord.free_money = Helper.Conv.ToDecimal(txtfree_money.Text.Trim()); ord.coin_no = "RMB"; ord.coin_rate = 1; ord.pay_way = txtpay_way.Text.Split('/')[0]; ord.approve_flag = "0"; ord.oper_id = txtoper_man.Text.Trim().Split('/')[0]; ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text.Trim()); ord.deal_man = txtpeople.Text.Split('/')[0]; ord.approve_man = ""; ord.approve_date = DateTime.MinValue; ord.other1 = txtmemo.Text.Trim(); ord.other2 = ""; ord.other3 = ""; ord.visa_id = txtvisa.Text.Split('/')[0]; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; ord.cm_branch = "00"; ord.branch_no = txtbranch.Text.Split('/')[0]; ord.from_date = DateTime.MinValue; ord.to_date = DateTime.MinValue; ord.rc_sheet_no = ""; int flag = 0; List <Model.rp_t_recpay_record_detail> lines = new List <Model.rp_t_recpay_record_detail>(); int index = 0; decimal pay_amt = ord.total_amount; decimal free_money = ord.free_money; decimal get_amt = 0; //应还客户金额 foreach (DataRow row in editGrid1.DataSource.Rows) { if (row["voucher_no"].ToString() != "" && row["select_flag"].ToString() == "1" && row["path"].ToString() == "-1") { get_amt += Conv.ToDecimal(row["pay_amount"]); } } pay_amt += get_amt; foreach (DataRow row in editGrid1.DataSource.Rows) { index++; if (row["voucher_no"].ToString() != "" && pay_amt >= 0 && row["select_flag"].ToString() == "1") { /* * if (Helper.Conv.ToDecimal(row["pay_amount"].ToString()) < 0) * { * throw new Exception("第i行付款金额不正确!".Replace("i", index.ToString())); * } * if (Helper.Conv.ToDecimal(row["pay_free"].ToString()) < 0) * { * throw new Exception("第i行免付金额不正确!".Replace("i", index.ToString())); * } */ decimal need_pay = Conv.ToDecimal(row["pay_amount"]); decimal repay_amt = 0; decimal pay_fee = 0; if (row["path"].ToString() == "-1") { repay_amt = need_pay; pay_fee = 0; } else { if (free_money > need_pay) { pay_fee = need_pay; } else { pay_fee = free_money; if (pay_amt > need_pay - pay_fee) { repay_amt = need_pay - pay_fee; } else { repay_amt = pay_amt; } } free_money -= pay_fee; pay_amt -= repay_amt; } Model.rp_t_recpay_record_detail line = new Model.rp_t_recpay_record_detail(); lines.Add(line); line.sheet_no = ord.sheet_no; line.voucher_no = row["voucher_no"].ToString(); line.sheet_amount = Helper.Conv.ToDecimal(row["sheet_amount"].ToString()); line.pay_amount = repay_amt; // Helper.Conv.ToDecimal(row["pay_amount"].ToString()); line.pay_free = pay_fee; // Helper.Conv.ToDecimal(row["pay_free"].ToString()); line.memo = row["memo"].ToString(); line.other1 = ""; line.other2 = ""; line.other3 = ""; line.num1 = 0; line.num2 = 0; line.num3 = 0; line.pay_date = System.DateTime.Now; line.item_no = ""; line.path = ((row["path"].ToString() == "1" || row["path"].ToString() == "+") ? "+" : "-"); line.select_flag = row["select_flag"].ToString(); line.voucher_type = row["voucher_type"].ToString(); line.oper_date = DateTime.Now; line.voucher_other1 = ""; line.voucher_other2 = ""; line.order_no = ""; flag = 1; } } if (flag == 0) { throw new Exception("无可结算明细!"); } if (runType == 1) { IBLL.ISupSettle bll = new BLL.SupSettle(); string sheet_no = ""; bll.Add(ord, lines, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { IBLL.ISupSettle bll = new BLL.SupSettle(); bll.Change(ord, lines); IOrder ins = this; ins.ShowOrder(ord.sheet_no); } Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); IBLL.ISys sys = new BLL.SysBLL(); string isApprove = sys.Read("approve_at_ones"); if ("1".Equals(isApprove)) { if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes) { tsbCheck_Click(new object(), new EventArgs()); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txtbranch.Text.Trim().Contains("/") == false) { throw new Exception("机构必填!"); } if (txtoper_date.Text.Trim() == "") { throw new Exception("单据日期必填!"); } pm_t_flow_main ord = new pm_t_flow_main(); List <pm_t_price_flow_detial> lines = new List <pm_t_price_flow_detial>(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.branch_no = txtbranch.Text.Trim().Split('/')[0]; ord.vip_type = ""; ord.price_type = "1"; ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text.Trim()); ord.oper_id = txtoper_man.Text.Split('/')[0]; ord.approve_flag = "0"; ord.memo = txtmemo.Text.Trim(); ord.other1 = ""; ord.other2 = ""; ord.other3 = ""; ord.cm_branch = "00"; ord.start_date = System.DateTime.MinValue; ord.end_date = System.DateTime.MinValue; ord.start_time = ""; ord.end_time = ""; ord.buy_amt = 0; ord.add_amt = 0; ord.deal_man = txtpeople.Text.Split('/')[0]; ord.approve_man = txtapprove_man.Text.Split('/')[0]; ord.approve_date = System.DateTime.MinValue; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; int flag = 0; foreach (DataRow row in editGrid1.DataSource.Rows) { if (row["item_no"].ToString() != "") { pm_t_price_flow_detial line = new pm_t_price_flow_detial(); lines.Add(line); line.sheet_no = ord.sheet_no; line.item_no = row["item_no"].ToString(); line.price_type = ord.price_type; line.start_date = ord.start_date; line.end_date = ord.end_date; line.discount = 0; line.buy_qnty = 0; line.other1 = ""; line.other2 = ""; line.other3 = ""; line.start_time = ""; line.end_time = ""; line.stock_qty = 0; line.num1 = 0; line.num2 = 0; line.num3 = 0; line.old_price = Helper.Conv.ToDecimal(row["old_price"].ToString()); line.old_price2 = Helper.Conv.ToDecimal(row["old_price2"].ToString()); line.old_price3 = Helper.Conv.ToDecimal(row["old_price3"].ToString()); line.new_price = string.IsNullOrEmpty(row["new_price"].ToString()) ? line.old_price : Helper.Conv.ToDecimal(row["new_price"].ToString()); line.new_price2 = string.IsNullOrEmpty(row["new_price2"].ToString()) ? line.old_price2 : Helper.Conv.ToDecimal(row["new_price2"].ToString()); line.new_price3 = string.IsNullOrEmpty(row["new_price3"].ToString()) ? line.old_price3 : Helper.Conv.ToDecimal(row["new_price3"].ToString()); flag = 1; } } if (flag == 0) { throw new Exception("表体无合法数据!"); } if (runType == 1) { IBLL.ICusPriceOrder bll = new BLL.CusPriceOrderBLL(); string sheet_no; bll.Add(ord, lines, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { IBLL.ICusPriceOrder bll = new BLL.CusPriceOrderBLL(); bll.Change(ord, lines); IOrder ins = this; ins.ShowOrder(ord.sheet_no); } Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); IBLL.ISys sys = new BLL.SysBLL(); string isApprove = sys.Read("approve_at_ones"); if ("1".Equals(isApprove)) { if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes) { tsbCheck_Click(new object(), new EventArgs()); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }