public void change_cgorder(WebHelper w, Dictionary <string, object> kv) { co_t_order_main ord = w.GetObject <co_t_order_main>(); ord.approve_flag = "0"; ord.approve_man = ""; ord.approve_date = DateTime.MinValue; List <co_t_order_child> lines = w.GetList <co_t_order_child>("lines"); bll.ChangeCGOrder(ord, lines); }
void IInOutBLL.ChangeCGOrder(co_t_order_main ord, List <co_t_order_child> lines) { Helper.JsonRequest r = new Helper.JsonRequest(); r.Write(ord); r.Write("lines", lines); r.request("/inout?t=change_cgorder"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } }
void IInOutBLL.AddCGOrder(co_t_order_main ord, List <co_t_order_child> lines, out string sheet_no) { Helper.JsonRequest r = new Helper.JsonRequest(); r.Write(ord); r.Write("lines", lines); r.request("/inout?t=add_cgorder"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } sheet_no = r.Read("sheet_no"); }
public void add_cgorder(WebHelper w, Dictionary <string, object> kv) { co_t_order_main ord = w.GetObject <co_t_order_main>(); ord.approve_flag = "0"; ord.approve_man = ""; ord.approve_date = DateTime.MinValue; List <co_t_order_child> lines = w.GetList <co_t_order_child>("lines"); string sheet_no = ""; bll.AddCGOrder(ord, lines, out sheet_no); w.Write("sheet_no", sheet_no); }
private void NewSheet() { sale_master = new co_t_order_main(); curr_cust = new bi_t_supcust_info(); sale_detail.Clear(); this.dgvItem.DataSource = sale_detail; NewItem(); frmSaleSheetMaster frm = new frmSaleSheetMaster(); ; if (frm.GetSheetSSMaster(null, null, out co_t_order_main master, out bi_t_supcust_info cust) == DialogResult.Yes) { this.sale_master = master; this.curr_cust = cust; }
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); }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txt_sup.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("供应商必填!"); return; } if (txtbranch.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("机构必填!"); return; } if (txtoper_date.Text.Trim() == "") { MsgForm.ShowFrom("单据日期必填!"); return; } co_t_order_main ord = new co_t_order_main(); List <co_t_order_child> lines = new List <co_t_order_child>(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.branch_no = txtbranch.Text.Trim().Split('/')[0]; ord.sup_no = txt_sup.Text.Trim().Split('/')[0]; ord.coin_code = "RMB"; ord.paid_amount = 0; ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text.Trim()); ord.oper_id = txtoper_man.Text.Split('/')[0]; ord.order_man = txt_order_man.Text.Split('/')[0]; ord.trans_no = "S"; ord.order_status = "0"; ord.sale_way = "A"; ord.p_sheet_no = ""; ord.approve_flag = "0"; ord.other1 = ""; ord.cm_branch = "00"; ord.approve_man = txtapprove_man.Text.Split('/')[0]; ord.approve_date = System.DateTime.MinValue; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; ord.valid_date = txt_valid_date.Text.ToDateTime(); ord.memo = txt_memo.Text; int flag = 0; int index = 0; decimal total_amt = 0; foreach (DataRow row in editGrid1.DataSource.Rows) { ++index; if (row["item_no"].ToString() != "") { co_t_order_child line = new co_t_order_child(); lines.Add(line); line.sheet_no = ord.sheet_no; line.item_no = row["item_no"].ToString(); line.unit_no = row["unit_no"].ToString(); line.barcode = row["barcode"].ToString(); line.unit_factor = 1; line.discount = row["discount"].ToDecimal(); line.in_price = Helper.Conv.ToDecimal(row["in_price"].ToString()); line.order_qnty = Helper.Conv.ToDecimal(row["order_qnty"].ToString()); line.sub_amount = Helper.Conv.ToDecimal(row["sub_amount"].ToString()); line.discount = 1; line.other1 = row["other1"].ToString(); line.other2 = ""; line.voucher_no = ""; line.sheet_sort = index; line.num1 = 0; line.num2 = 0; line.num3 = 0; line.packqty = 0; line.sgqty = 0; flag = 1; total_amt += line.order_qnty * line.in_price; } } if (flag == 0) { MsgForm.ShowFrom("请输入表单明细"); return; } ord.total_amount = total_amt; IBLL.IInOutBLL bll = new BLL.InOutBLL(); if (runType == 1) { var sheet_no = ""; bll.AddCGOrder(ord, lines, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { bll.ChangeCGOrder(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("frmCGOrder->Save()", ex.ToString(), txtsheet_no.Text); MsgForm.ShowFrom("采购订单保存异常[" + ex.Message + "]"); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
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; } co_t_order_main ord = new co_t_order_main(); List <co_t_order_child> lines = new List <co_t_order_child>(); ord.sheet_no = ""; ord.trans_no = "S"; ord.order_status = "0"; ord.sale_way = "A"; ord.coin_code = "RMB"; ord.branch_no = sale_master.branch_no; ord.p_sheet_no = ""; ord.sup_no = sale_master.sup_no; ord.paid_amount = 0; ord.oper_date = sale_master.oper_date; ord.oper_id = Program.oper.oper_id; ord.order_man = "00"; ord.approve_flag = "0"; ord.other1 = ""; ord.other2 = ""; ord.cm_branch = "00"; ord.approve_man = ""; ord.approve_date = System.DateTime.MinValue; ord.num1 = 0; ord.num2 = 0; ord.num3 = 0; ord.valid_date = sale_master.oper_date.AddMonths(1); ord.memo = sale_master.memo; int index = 0; decimal total_amt = 0; foreach (DataRow row in sale_detail.Rows) { ++index; if (row["item_no"].ToString() != "") { co_t_order_child line = new co_t_order_child(); lines.Add(line); line.sheet_no = ord.sheet_no; line.item_no = row["item_no"].ToString(); line.unit_no = row["unit_no"].ToString(); line.barcode = row["barcode"].ToString(); line.unit_factor = 1; line.order_qnty = Helper.Conv.ToDecimal(row["order_qnty"].ToString()); line.in_price = Helper.Conv.ToDecimal(row["in_price"].ToString()); line.real_qty = 0; line.sub_amount = Helper.Conv.ToDecimal(row["sub_amount"].ToString()); line.sheet_sort = index; line.discount = 1; line.other1 = row["other1"].ToString(); line.other2 = ""; line.other3 = "0"; line.voucher_no = ""; line.sheet_sort = index; line.num1 = 0; line.num2 = 0; line.num3 = 0; line.packqty = 0; line.sgqty = 0; total_amt += line.in_price * line.order_qnty; } } ord.total_amount = total_amt; ord.paid_amount = 0; string sheet_no; IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.AddSaleSSSheet(ord, lines, out sheet_no); NewSheet(); }