private void SaveMaster() { if (sheet_master == null) { sheet_master = new sm_t_salesheet(); } if (branch == null || string.IsNullOrEmpty(branch.branch_no)) { errMsg = "请输入客户"; SwitchTab(txt_branch.TabIndex); return; } if (supcust == null || string.IsNullOrEmpty(supcust.supcust_no)) { errMsg = "请输入客户"; SwitchTab(txt_cust.TabIndex); return; } sheet_master.branch_no = branch.branch_no; sheet_master.oper_date = this.dtp_oper_date.Value; sheet_master.cust_no = supcust.supcust_no; sheet_master.other1 = this.txt_memo.Text.Trim(); this.DialogResult = DialogResult.Yes; this.Close(); }
private void NewSheet() { sale_master = new sm_t_salesheet(); curr_cust = new bi_t_supcust_info(); sale_detail.Clear(); this.dgvItem.DataSource = sale_detail; NewItem(); frmSaleSheetMaster frm = new frmSaleSheetMaster(); if (frm.GetSheetMaster(null, null, out sm_t_salesheet o_master, out bi_t_supcust_info o_supcust) == DialogResult.Yes) { this.sale_master = o_master; this.curr_cust = o_supcust; }
public DialogResult GetSheetMaster(sm_t_salesheet sheet_master, bi_t_supcust_info supcust, out sm_t_salesheet master, out bi_t_supcust_info cust) { this.sheet_master = sheet_master; this.supcust = supcust; DialogResult result = this.ShowDialog(); if (result == DialogResult.Yes) { master = this.sheet_master; cust = this.supcust; } else { master = null; cust = null; } return(result); }
public DialogResult GetSheetSSMaster(co_t_order_main sheet_master, bi_t_supcust_info supcust, out co_t_order_main master, out bi_t_supcust_info cust) { this.sheet_master = null; if (sheet_master != null) { this.sheet_master = new sm_t_salesheet { cust_no = sheet_master.sup_no, other1 = sheet_master.memo, oper_date = sheet_master.oper_date }; this.supcust = supcust; } DialogResult result = this.ShowDialog(); if (result == DialogResult.Yes) { master = null; if (this.sheet_master != null) { master = new co_t_order_main { sup_no = this.sheet_master.cust_no, memo = this.sheet_master.other1, oper_date = this.sheet_master.oper_date, branch_no = this.sheet_master.branch_no, }; } cust = this.supcust; } else { master = null; cust = null; } return(result); }
private void SaveSheet() { if (curr_cust == null || string.IsNullOrEmpty(curr_cust.supcust_no)) { MsgForm.ShowFrom("请选择客户!"); return; } if (sale_detail.Rows.Count < 1) { MsgForm.ShowFrom("请输入明细!"); return; } sm_t_salesheet ord = new sm_t_salesheet(); List <sm_t_salesheet_detail> lines = new List <sm_t_salesheet_detail>(); ord.sheet_no = ""; ord.branch_no = sale_master.branch_no; ord.voucher_no = ""; ord.cust_no = sale_master.cust_no; ord.pay_way = ""; ord.discount = 1; ord.coin_no = "RMB"; ord.paid_amount = 0; ord.oper_date = sale_master.oper_date; ord.oper_id = Program.oper.oper_id; ord.sale_man = "00"; ord.approve_flag = "0"; ord.other1 = sale_master.other1; ord.other2 = "0"; ord.other3 = ""; ord.other4 = ""; ord.old_no = ""; ord.cm_branch = "00"; ord.psheet_no = ""; ord.pay_nowmark = ""; ord.payfee_memo = ""; ord.if_back = "0"; ord.approve_man = ""; ord.approve_date = System.DateTime.MinValue; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; ord.pay_date = sale_master.oper_date.AddMonths(1); int index = 0; decimal total_amt = 0; foreach (DataRow row in sale_detail.Rows) { ++index; if (row["item_no"].ToString() != "") { sm_t_salesheet_detail line = new sm_t_salesheet_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.sale_qnty = Helper.Conv.ToDecimal(row["sale_qnty"].ToString()); line.sale_price = Helper.Conv.ToDecimal(row["real_price"].ToString()); line.real_price = Helper.Conv.ToDecimal(row["real_price"].ToString()); line.cost_price = 0; line.sale_money = Helper.Conv.ToDecimal(row["sale_money"].ToString()); line.discount = 1; line.sale_tax = 0; line.is_tax = "0"; line.other1 = row["other1"].ToString(); line.other2 = ""; line.other3 = "0"; line.other4 = ""; 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.num7 = 0; line.num8 = 0; line.cost_notax = 0; line.packqty = 0; line.sgqty = 0; total_amt += line.sale_qnty * line.real_price; } } ord.real_amount = total_amt; ord.total_amount = total_amt; IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.AddSaleSheet(ord, lines, out string sheet_no); NewSheet(); }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txt_cust.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("客户编码必填!"); return; } if (txtbranch.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("机构必填!"); return; } if (txtoper_date.Text.Trim() == "") { MsgForm.ShowFrom("单据日期必填!"); return; } sm_t_salesheet ord = new sm_t_salesheet(); List <sm_t_salesheet_detail> lines = new List <sm_t_salesheet_detail>(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.branch_no = txtbranch.Text.Trim().Split('/')[0]; ord.voucher_no = txt_voucher_no.Text.Trim(); ord.cust_no = txt_cust.Text.Trim().Split('/')[0]; ord.pay_way = ""; ord.discount = Helper.Conv.ToDecimal(txt_discount.Text.Trim()); ord.coin_no = lbl_coin_no.Text.Trim(); ord.paid_amount = Helper.Conv.ToDecimal(txt_paid_amount.Text); ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text.Trim()); ord.oper_id = txtoper_man.Text.Split('/')[0]; ord.sale_man = txt_sale_man.Text.Split('/')[0]; ord.approve_flag = "0"; ord.other1 = ""; ord.other2 = (txt_other2.Text.Trim() == "是" ? "1" : "0"); ord.other3 = ""; ord.other4 = ""; ord.old_no = txt_old_no.Text.Trim(); ord.cm_branch = "00"; ord.psheet_no = ""; ord.pay_nowmark = ""; ord.payfee_memo = txtmemo.Text.Trim(); ord.if_back = "0"; ord.approve_man = txtapprove_man.Text.Split('/')[0]; ord.approve_date = System.DateTime.MinValue; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; ord.pay_date = Helper.Conv.ToDateTime(txt_pay_date.Text.Trim()); ord.create_time = DateTime.Now; 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() != "") { sm_t_salesheet_detail line = new sm_t_salesheet_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.sale_qnty = Helper.Conv.ToDecimal(row["sale_qnty"].ToString()); line.sale_price = Helper.Conv.ToDecimal(row["real_price"].ToString()); line.real_price = Helper.Conv.ToDecimal(row["real_price"].ToString()); line.cost_price = 0; line.sale_money = Helper.Conv.ToDecimal(row["sale_money"].ToString()); line.discount = 1; line.sale_tax = 0; line.is_tax = "0"; line.other1 = ""; line.other2 = ""; line.other3 = (row["other3"].ToString() == "是" ? "1" : "0"); line.other4 = ""; line.other5 = row["other5"].ToString(); 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.num7 = 0; line.num8 = 0; line.cost_notax = 0; line.packqty = 0; line.sgqty = 0; flag = 1; total_amt += line.sale_qnty * line.real_price; } } if (flag == 0) { MsgForm.ShowFrom("请输入表单明细"); return; } ord.real_amount = total_amt; ord.total_amount = total_amt; if (runType == 1) { IBLL.IInOutBLL bll = new BLL.InOutBLL(); var sheet_no = ""; bll.AddSaleSheet(ord, lines, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.ChangeSaleSheet(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("frmSaleSheet->Save()", ex.ToString(), txtsheet_no.Text); MsgForm.ShowFrom("批发销售单保存异常[" + ex.Message + "]"); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }