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("frmSaleInSheetList->tsbAdd_Click()", ex.ToString()); } }
private void btnOk_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.txtGrout.Text)) { this.txtGrout.Focus(); return; } IBLL.IOper bll = new BLL.OperBLL(); if (oper_type == null) { oper_type = new sa_t_oper_type() { type_name = this.txtGrout.Text, update_time = DateTime.Now }; bll.AddOperType(oper_type); } else { oper_type.type_name = this.txtGrout.Text; oper_type.update_time = DateTime.Now; bll.ChangeOperType(oper_type); } this.DialogResult = DialogResult.Yes; this.Close(); } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbCheck_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "05")) { return; } if (txtsheet_no.Text.Trim() != "") { string sheet_no = txtsheet_no.Text.Trim(); IBLL.ISupSettle bll = new BLL.SupSettle(); bll.Check(sheet_no, Program.oper.oper_id); IOrder ins = this; ins.ShowOrder(sheet_no); } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbCheck_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "05")) { return; } if (sheet_no != null && sheet_no != "") { IBLL.IInOutBLL bll = new BLL.InOutBLL(); bll.CheckInOut(sheet_no, Program.oper.oper_id, update_time); IOrder ins = this; ins.ShowOrder(sheet_no); } } catch (Exception ex) { MsgForm.ShowFrom("审核单据异常[" + ex.Message + "]"); Helper.LogHelper.writeLog("frmOtherInOutSheet->tsbCheck_Click()", ex.ToString(), sheet_no); } }
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); } }
/* Asynchrononous drill-through. * This is unstable. You sometimes get an error message in Excel after double-clicking. * So, we'll only expose this in the menu, not for double-click. */ //[ExcelCommand(MenuName = "&DAX Drill", MenuText = "DrillThrough")] public static void DrillThrough_Async() { Excel.Range rngCell = xlApp.ActiveCell; if (!ExcelHelper.IsPivotDataCell(rngCell)) { return; } var queryClient = new QueryClient(rngCell); Task.Factory.StartNew(() => DrillThroughThreadSafe(queryClient)) .ContinueWith(t => { ExcelAsyncUtil.QueueAsMacro(() => { if (t.Exception != null) { MsgForm.ShowMessage(t.Exception); } }); }); }
private void frmPeople_Load(object sender, EventArgs e) { try { Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.IDept bll = new BLL.DeptBLL(); dept_lis = bll.GetAllList(); this.Invoke((MethodInvoker) delegate { Cursor.Current = Cursors.WaitCursor; LoadTv(); LoadDataGrid(); Cursor.Current = Cursors.Default; }); } catch (Exception ex) { LogHelper.writeLog("frmDept=>LoadItemCls", "获取商品分类出错!"); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); LogHelper.writeLog("frmPeople=>load", ex.ToString()); } finally { } }
public void searchDataVwMstProduct() { MST001Controller mst001Ctrl = new MST001Controller(); try { object[] result = mst001Ctrl.searchDataVwMstProduct(); MsgForm msgForm = (MsgForm)result[0]; List <VW_MST_PRODUCT> lstdata = (List <VW_MST_PRODUCT>)result[1]; if (msgForm.statusFlag.Equals(1)) { dataGridView1.DataSource = lstdata; dataGridView1.DefaultCellStyle.Font = new Font("TH SarabunPSK", 16); dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; dataGridView1.EnableHeadersVisualStyles = false; dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.SkyBlue; dataGridView1.ColumnHeadersHeight = 150; dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("TH SarabunPSK", 16, FontStyle.Bold); dataGridView1.RowTemplate.Height = 40; dataGridView1.Columns[0].HeaderCell.Value = "รหัสสินค้า"; dataGridView1.Columns[1].HeaderCell.Value = "ชื่อสินค้า"; dataGridView1.Columns[2].HeaderCell.Value = "ชื่อหน่วยสินค้า"; lblCountData.Text = "แสดงข้อมูลทั้งหมด " + lstdata.Count() + " รายการ"; } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } catch (Exception ex) { log.Error(ex.ToString(), ex); MessageBox.Show("Error : " + ex.ToString()); } }
public void LoadOper() { Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { Cursor.Current = Cursors.WaitCursor; IBLL.IOper bll = new BLL.OperBLL(); tb = bll.GetOpers(); tb.Columns.Add("密码"); foreach (DataRow dr in tb.Rows) { var i = dr["oper_pw"].ToString().Length; dr["密码"] = new string('*', i); } this.dgvOper.Invoke((MethodInvoker) delegate { this.dgvOper.DataSource = tb; }); Cursor.Current = Cursors.Default; } catch (Exception ex) { LogHelper.writeLog("LoadOper", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
private void LoadTv() { string keyword = txtKeyword.Text.Trim(); Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICommonBLL bll = new BLL.CommonBLL(); cust_list = bll.GetCustList(keyword); this.Invoke((MethodInvoker) delegate { Cursor.Current = Cursors.WaitCursor; this.tv.Nodes.Clear(); TreeNode tn = new TreeNode("客户信息"); tn.Tag = ""; this.tv.Nodes.Add(tn); LoadTreeView(); Cursor.Current = Cursors.Default; }); } catch (Exception ex) { LogHelper.writeLog("SysSetting_Load", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
void IOrder.Add() { try { RunType = 1; this.txt_cust.Text = ""; this.txtbranch.GetDefaultValue(); this.txtsheet_no.Text = ""; this.txtoper_date.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); this.txt_pay_date.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); this.txt_voucher_no.Text = ""; this.txtapprove_man.Text = ""; this.txtoper_man.Text = Program.oper.oper_id + "/" + Program.oper.oper_name; this.txt_other3.Text = ""; this.txtapprove_date.Text = ""; this.txt_other1.Text = ""; this.txt_other2.Text = ""; // var tb = editGrid1.DataSource; tb.Clear(); for (int i = 0; i < 1; i++) { tb.Rows.Add(tb.NewRow()); } editGrid1.Refresh(); Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void refreshData() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // DateTime date1 = Helper.Conv.ToDateTime(dateTextBox1.Text.Trim()); DateTime date2 = Helper.Conv.ToDateTime(dateTextBox2.Text.Trim()); string txt_sup = txt_sup_id.Text.Split('/')[0].Trim(); Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.IInOutBLL bll = new BLL.InOutBLL(); if (date1 == DateTime.MinValue) { throw new Exception("期间不正确"); } if (date2 == DateTime.MinValue) { throw new Exception("期间不正确"); } var tb = bll.GetCGOrderList(date1, date2, txt_sup, ""); this.dataGrid1.Invoke((MethodInvoker) delegate { this.dataGrid1.DataSource = tb; if (tb.Rows.Count > 0) { sheet_no = tb.Rows[0]["sheet_no"].ToString(); trans_no = tb.Rows[0]["trans_no"].ToString(); System.Data.DataTable tb1; System.Data.DataTable tb2; bll.GetCGOrder(sheet_no, out tb1, out tb2); this.dataGrid2.DataSource = tb2; update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]); } }); } catch (Exception ex) { LogHelper.writeLog("refreshData", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCGInSheetList->refreshData()", ex.ToString()); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
void IOrder.ShowOrder(string sheet_no) { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // RunType = 2; IBLL.IInOutBLL bll = new BLL.InOutBLL(); DataTable tb1; DataTable tb2; bll.GetCGOrder(sheet_no, out tb1, out tb2); // // var r1 = tb1.Rows[0]; update_time = Helper.Conv.ToDateTime(r1["update_time"]); this.sheet_no = sheet_no; if (r1["branch_no"].ToString() == "") { txtbranch.Text = ""; } else { txtbranch.Text = r1["branch_no"].ToString() + "/" + r1["branch_name"].ToString(); } txtsheet_no.Text = r1["sheet_no"].ToString(); txtoper_date.Text = Helper.Conv.ToDateTime(r1["oper_date"].ToString()).ToString("yyyy-MM-dd"); if (r1["order_man"].ToString() == "") { txt_order_man.Text = ""; } else { txt_order_man.GetValue("oper_id", r1["order_man"].ToString()); } if (r1["approve_man"].ToString() == "") { txtapprove_man.Text = ""; } else { txtapprove_man.Text = r1["approve_man"].ToString() + "/" + r1["approve_man_name"].ToString(); } if (r1["oper_id"].ToString() == "") { txtoper_man.Text = ""; } else { txtoper_man.Text = r1["oper_id"] + "/" + r1["oper_name"]; } txtapprove_date.Text = Helper.Conv.ToDateTime(r1["approve_date"]).ToString("yyyy-MM-dd"); txt_valid_date.Text = Helper.Conv.ToDateTime(r1["valid_date"]).ToString("yyyy-MM-dd"); txt_sup.Text = r1["sup_no"].ToString() + "/" + r1["sup_name"].ToString(); txt_memo.Text = r1["memo"].ToString(); // editGrid1.DataSource = tb2; Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); } catch (Exception ex) { MsgForm.ShowFrom("加载采购订单异常[" + ex.Message + "]"); Helper.LogHelper.writeLog("frmCGOrder->ShowOrder()", ex.ToString(), sheet_no); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
void IOrder.ShowOrder(string sheet_no) { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // RunType = 2; IBLL.IInOutBLL bll = new BLL.InOutBLL(); DataTable tb1; DataTable tb2; bll.GetOtherInOut(sheet_no, out tb1, out tb2); // // var r1 = tb1.Rows[0]; update_time = Helper.Conv.ToDateTime(r1["update_time"]); this.sheet_no = sheet_no; if (r1["branch_no"].ToString() == "") { txtbranch.Text = ""; } else { txtbranch.Text = r1["branch_no"].ToString() + "/" + r1["branch_name"].ToString(); } txtsheet_no.Text = r1["sheet_no"].ToString(); txtoper_date.Text = Helper.Conv.ToDateTime(r1["oper_date"].ToString()).ToString("yyyy-MM-dd"); if (r1["deal_man"].ToString() == "") { txt_deal_man.Text = ""; } else { txt_deal_man.Text = r1["deal_man"].ToString() + "/" + r1["deal_man_name"].ToString(); } if (r1["approve_man"].ToString() == "") { txtapprove_man.Text = ""; } else { txtapprove_man.Text = r1["approve_man"].ToString() + "/" + r1["approve_man_name"].ToString(); } if (r1["oper_id"].ToString() == "") { txtoper_man.Text = ""; } else { txtoper_man.Text = r1["oper_id"] + "/" + r1["oper_name"]; } txtapprove_date.Text = Helper.Conv.ToDateTime(r1["approve_date"]).ToString("yyyy-MM-dd"); var trans_name = ""; var trans_no = r1["trans_no"].ToString(); if (trans_no == "01") { trans_name = "其它入库"; } else if (trans_no == "02") { trans_name = "归还"; } else if (trans_no == "03") { trans_name = "其它出库"; } else if (trans_no == "04") { trans_name = "领用出库"; } else if (trans_no == "05") { trans_name = "报损出库"; } else if (trans_no == "06") { trans_name = "借出"; } else if (trans_no == "07") { trans_name = "报溢入库"; } else if (trans_no == "09") { trans_name = "库存调整"; } txt_trans_no.Text = trans_no + "/" + trans_name; txt_other3.Text = r1["other3"].ToString(); txt_old_no.Text = r1["old_no"].ToString(); // editGrid1.DataSource = tb2; Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); } catch (Exception ex) { MsgForm.ShowFrom("加载其它出入单异常[" + ex.Message + "]"); Helper.LogHelper.writeLog("frmOtherInOutSheet->ShowOrder()", ex.ToString(), sheet_no); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
public void insertOrUpdateDataMstDestination() { MST004Controller mst004Ctrl = new MST004Controller(); MST_DESTINATION form = new MST_DESTINATION(); try { if (Util.isEmpty(txtDistinationId.Text) || Util.isEmpty(txtDistinationName.Text)) { MessageBox.Show(CommonUtil.REQUIRE_MESSAGE); return; } form.DESTINATION_ID = txtDistinationId.Text; form.DESTINATION_NAME = txtDistinationName.Text; form.DESTINATION_ADDRESS = txtDistinationAddress.Text; form.DESTINATION_DISTRICT = Int32.Parse(cboDistricts.SelectedValue.ToString()); form.DESTINATION_AMPHURE = Int32.Parse(cboAmphure.SelectedValue.ToString()); form.DESTINATION_PROVINCE = Int32.Parse(cboProvince.SelectedValue.ToString()); form.DESTINATION_POSTCODE = txtDistinationPostcode.Text; form.DESTINATION_TEL_NO = txtDistinationTelNo.Text; form.DESTINATION_FAX = txtDistinationFax.Text; if (Util.isEmpty(form)) { return; } object[] result = mst004Ctrl.insertOrUpdateDataMstDestination(form, flagAddEdit); MsgForm msgForm = (MsgForm)result[0]; MST_DESTINATION data = (MST_DESTINATION)result[1]; if (flagAddEdit.Equals("A")) { if (Util.isNotEmpty(data)) { if (msgForm.statusFlag.Equals(1)) { MessageBox.Show(CommonUtil.DUPLICATE_DATA); } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } else { if (msgForm.statusFlag.Equals(1)) { resetDataMstDistination(); searchDataVwMstDestination(); MessageBox.Show(CommonUtil.SAVE_DATA_SUCCESS); } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } } else if (flagAddEdit.Equals("E")) { if (msgForm.statusFlag.Equals(1)) { resetDataMstDistination(); searchDataVwMstDestination(); MessageBox.Show(CommonUtil.SAVE_DATA_SUCCESS); } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } } catch (Exception ex) { log.Error(ex.ToString(), ex); MessageBox.Show("Error : " + ex.ToString()); } }
private void LoadSup() { if (!MyLove.PermissionsBalidation(this.Text, "18")) { return; } page.PageSize = this.dgvSup.MaxDisplayRowCount(); Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { Cursor.Current = Cursors.WaitCursor; string cls_no = ""; this.tv.Invoke((MethodInvoker) delegate { if (this.tv.SelectedNode != null) { if (this.tv.SelectedNode.Tag != null) { var item = (Model.bi_t_region_info) this.tv.SelectedNode.Tag; cls_no = item.region_no; } } }); string SelectedNode = ""; string Keyword = ""; int ShowStopSup = 0; this.Invoke((MethodInvoker) delegate { SelectedNode = this.tv.SelectedNode == null ? "" : cls_no; Keyword = this.txtKeyword.Text.Trim(); ShowStopSup = this.cbShowStopSup.Checked ? 1 : 0; }); if (_runType == 0) { IBLL.ISup bll = new BLL.SupBLL(); page = bll.GetDataTable( SelectedNode, Keyword, ShowStopSup, page ); } else if (_runType == 1) { IBLL.ICus bll = new BLL.CusBLL(); page = bll.GetDataTable( SelectedNode, Keyword, ShowStopSup, page ); } Conv.AddColorTable(page.tb, "display_flag"); this.Invoke((MethodInvoker) delegate { this.dgvSup.DataSource = page.tb; this.lblMaxIndex.Text = page.PageMax.ToString(); this.lblIndex.Text = page.PageIndex.ToString(); }); Cursor.Current = Cursors.Default; } catch (Exception ex) { LogHelper.writeLog("LoadSup", "获取商品分类出错!"); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
public frmCGOrder() { InitializeComponent(); // Helper.GlobalData.InitForm(this); // var tb = new DataTable(); tb.Columns.Add("item_no"); tb.Columns.Add("item_subno"); tb.Columns.Add("barcode"); tb.Columns.Add("item_name"); tb.Columns.Add("unit_no"); tb.Columns.Add("item_size"); tb.Columns.Add("order_qnty", typeof(decimal)); tb.Columns.Add("in_price", typeof(decimal)); tb.Columns.Add("discount", typeof(decimal)); tb.Columns.Add("sub_amount", typeof(decimal)); tb.Columns.Add("other1"); editGrid1.AddColumn("item_subno", "货号", "", 120, 1, "", true); editGrid1.AddColumn("item_name", "商品名称", "", 150, 1, "", false); editGrid1.AddColumn("unit_no", "单位", "", 60, 2, "", false); editGrid1.AddColumn("item_size", "规格", "", 60, 2, "", false); editGrid1.AddColumn("order_qnty", "总数量", "", 100, 3, "0.00", true); editGrid1.AddColumn("in_price", "单价", "", 100, 3, "0.00", true); editGrid1.AddColumn("discount", "折扣", "", 100, 3, "0.00", false); editGrid1.AddColumn("sub_amount", "金额", "", 100, 3, "0.00", true); editGrid1.AddColumn("other1", "备注", "", 150, 1, "", true); editGrid1.SetTotalColumn("order_qnty,sub_amount");//合计项 editGrid1.DataSource = tb; editGrid1.IsShowIco = true; // try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICommonBLL bll2 = new BLL.CommonBLL(); var branch_tb = bll2.GetBranchList(); this.txtbranch.Invoke((MethodInvoker) delegate { txtbranch.Bind(branch_tb, 300, 200, "branch_no", "branch_no:编号:80,branch_name:名称:140", "branch_no/branch_name->Text"); }); var sup_tb = bll2.GetAllSupList(); this.txt_sup.Invoke((MethodInvoker) delegate { txt_sup.Bind(sup_tb, 350, 200, "supcust_no", "supcust_no:编号:80,sup_name:名称:200", "supcust_no/sup_name->Text"); }); var deal_tb = bll2.GetPeopleList(); this.txt_order_man.Invoke((MethodInvoker) delegate { txt_order_man.Bind(deal_tb, 250, 200, "oper_id", "oper_id:编号:80,oper_name:姓名:100", "oper_id/oper_name->Text"); }); this.Invoke((MethodInvoker) delegate { IOrder ins = this; ins.Add(); }); } catch (Exception ex) { LogHelper.writeLog("frmCGOrder", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCGOrder()", ex.ToString()); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
void IOrder.ShowOrder(string sheet_no) { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // RunType = 2; IBLL.ISupSettle bll = new BLL.SupSettle(); DataTable tb1; DataTable tb2; bll.GetOrder(sheet_no, out tb1, out tb2); // // var r1 = tb1.Rows[0]; if (r1["sup_no"].ToString() == "") { txtsup.Text = ""; } else { txtsup.Text = r1["sup_no"].ToString() + "/" + r1["sup_name"].ToString(); } if (r1["branch_no"].ToString() == "") { txtbranch.Text = ""; } else { txtbranch.Text = r1["branch_no"].ToString() + "/" + r1["branch_name"].ToString(); } txtsheet_no.Text = r1["sheet_no"].ToString(); txtoper_date.Text = Helper.Conv.ToDateTime(r1["oper_date"].ToString()).ToString("yyyy-MM-dd"); if (r1["deal_man"].ToString() == "") { txtpeople.Text = ""; } else { txtpeople.Text = r1["deal_man"].ToString() + "/" + r1["deal_man_name"].ToString(); } if (r1["approve_man"].ToString() == "") { txtapprove_man.Text = ""; } else { txtapprove_man.Text = r1["approve_man"].ToString() + "/" + r1["approve_man_name"].ToString(); } if (r1["oper_id"].ToString() == "") { txtoper_man.Text = ""; } else { txtoper_man.Text = r1["oper_id"] + "/" + r1["oper_name"]; } txtmemo.Text = r1["other1"].ToString(); DateTime dt; if (DateTime.TryParse(r1["approve_date"].ToString(), out dt) == true) { txtapprove_date.Text = dt.ToString("yyyy-MM-dd"); } else { txtapprove_date.Text = ""; } txttotal_amount.Text = Helper.Conv.ToDecimal(r1["total_amount"].ToString()).ToString("0.00"); txtfree_money.Text = Helper.Conv.ToDecimal(r1["free_money"].ToString()).ToString("0.00"); if (r1["pay_way"].ToString() == "") { txtpay_way.Text = ""; } else { txtpay_way.Text = r1["pay_way"].ToString() + "/" + r1["pay_name"].ToString(); } if (r1["visa_id"].ToString() == "") { txtvisa.Text = ""; } else { txtvisa.Text = r1["visa_id"].ToString() + "/" + r1["visa_name"].ToString(); } // editGrid1.DataSource = tb2; Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); } 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 (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; } }
private void LoadCb() { Thread th = new Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.IRegion bll = new BLL.RegionBLL(); sup_tb = bll.GetDataTable(); IBLL.IPeople pbll = new BLL.PeopleBLL(); int count; peo_tb = pbll.GetDataTable("", "", 1, 1, 99999, out count); this.Invoke((MethodInvoker) delegate { //货商区域 this.txtRegion.Bind(sup_tb, 300, 200, "region_no", "region_no:编号:80,region_name:区域:150", "region_no/region_name->Text"); //货商分类 Dictionary <string, string> dic = new Dictionary <string, string>() { { "00", "不定" } }; this.cbSupType.DisplayMember = "Value"; this.cbSupType.ValueMember = "Key"; this.cbSupType.DataSource = new BindingSource(dic, null); //业务员 this.txtPeo.Bind(peo_tb, 250, 200, "oper_id", "oper_id:编号:80,oper_name:名字:150", "oper_id/oper_name->Text"); //价格等级 Dictionary <string, string> dic3 = new Dictionary <string, string>() { { "1", "一级批发价" }, { "2", "二级批发价" }, { "3", "三级批发价" }, }; this.cbPriceLevel.DisplayMember = "Value"; this.cbPriceLevel.ValueMember = "Key"; this.cbPriceLevel.DataSource = new BindingSource(dic3, null); //客户组 IBLL.ISupcustGroup gbll = new BLL.SupcustGroupBLL(); DataTable flag = new DataTable(); if (_runType == 0) { flag = gbll.GetSupGroup(); } else if (_runType == 1) { flag = gbll.GetCusGroup(); } if (flag.Columns.Count < 1) { flag = Conv.Assign <bi_t_supcust_group>(); } DataRow dr = flag.NewRow(); dr["SupCust_GroupNo"] = "0"; dr["SupCust_GroupName"] = "不定"; flag.Rows.InsertAt(dr, 0); this.cb_supcust_group.DisplayMember = "SupCust_GroupName"; this.cb_supcust_group.ValueMember = "SupCust_GroupNo"; this.cb_supcust_group.DataSource = flag; LoadSup(); }); } catch (Exception ex) { LogHelper.writeLog("LoadCb", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
public object[] insertOrUpdateDataMstProduct(MST_PRODUCT param, string flagAddEdit) { log.Info("Start log INFO... insertOrUpdateDataMstProduct"); MsgForm msgError = new MsgForm(); MST_PRODUCT formInsert = new MST_PRODUCT(); MST_PRODUCT formUpdate = new MST_PRODUCT(); try { using (var db = new PaknampoScaleDBEntities()) { formUpdate = (from row in db.MST_PRODUCT where row.PRODUCT_ID == param.PRODUCT_ID select row).FirstOrDefault(); if (flagAddEdit.Equals("A")) { if (Util.isEmpty(formUpdate)) { //formInsert.PRODUCT_ID = db.MST_PRODUCT.Count() + 1; formInsert.PRODUCT_ID = param.PRODUCT_ID; formInsert.PRODUCT_NAME = param.PRODUCT_NAME; formInsert.PRODUCT_UNIT = param.PRODUCT_UNIT; db.MST_PRODUCT.Add(formInsert); log.Info("Insert Data form MST_PRODUCT" + " PRODUCT_ID : " + formInsert.PRODUCT_ID + " PRODUCT_NAME : " + formInsert.PRODUCT_NAME + " PRODUCT_UNIT : " + formInsert.PRODUCT_UNIT ); } } else if (flagAddEdit.Equals("E")) { if (Util.isNotEmpty(formUpdate)) { formUpdate.PRODUCT_ID = param.PRODUCT_ID; formUpdate.PRODUCT_NAME = param.PRODUCT_NAME; formUpdate.PRODUCT_UNIT = param.PRODUCT_UNIT; log.Info("Update Data form MST_PRODUCT" + " PRODUCT_ID : " + formUpdate.PRODUCT_ID + " PRODUCT_NAME : " + formUpdate.PRODUCT_NAME + " PRODUCT_UNIT : " + formUpdate.PRODUCT_UNIT ); } } //formUpdate = (from row in db.MST_PRODUCT where row.PRODUCT_ID == param.PRODUCT_ID select row).FirstOrDefault(); //if (CheckUtil.isEmpty(formUpdate)) //{ // //formInsert.PRODUCT_ID = db.MST_PRODUCT.Count() + 1; // formInsert.PRODUCT_ID = param.PRODUCT_ID; // formInsert.PRODUCT_NAME = param.PRODUCT_NAME; // formInsert.PRODUCT_UNIT = param.PRODUCT_UNIT; // db.MST_PRODUCT.Add(formInsert); //} //else if (CheckUtil.isNotEmpty(formUpdate)) //{ // formUpdate.PRODUCT_ID = param.PRODUCT_ID; // formUpdate.PRODUCT_NAME = param.PRODUCT_NAME; // formUpdate.PRODUCT_UNIT = param.PRODUCT_UNIT; //} db.SaveChanges(); msgError.statusFlag = MsgForm.STATUS_SUCCESS; } } catch (Exception ex) { log.Error(ex.ToString(), ex); msgError.statusFlag = MsgForm.STATUS_ERROR; msgError.messageDescription = ex.ToString(); } finally { log.Info("End log INFO... insertOrUpdateDataMstProduct"); } return(new object[] { msgError, formUpdate }); }
public object[] insertOrUpdateDataMstDestination(MST_DESTINATION param, string flagAddEdit) { log.Info("Start log INFO... insertOrUpdateDataMstDestination"); MsgForm msgError = new MsgForm(); MST_DESTINATION formInsert = new MST_DESTINATION(); MST_DESTINATION formUpdate = new MST_DESTINATION(); try { using (var db = new PaknampoScaleDBEntities()) { formUpdate = (from row in db.MST_DESTINATION where row.DESTINATION_ID == param.DESTINATION_ID select row).FirstOrDefault(); if (flagAddEdit.Equals("A")) { if (Util.isEmpty(formUpdate)) { //formInsert.PRODUCT_ID = db.MST_PRODUCT.Count() + 1; formInsert.DESTINATION_ID = param.DESTINATION_ID; formInsert.DESTINATION_NAME = param.DESTINATION_NAME; formInsert.DESTINATION_ADDRESS = param.DESTINATION_ADDRESS; formInsert.DESTINATION_DISTRICT = param.DESTINATION_DISTRICT; formInsert.DESTINATION_AMPHURE = param.DESTINATION_AMPHURE; formInsert.DESTINATION_PROVINCE = param.DESTINATION_PROVINCE; formInsert.DESTINATION_POSTCODE = param.DESTINATION_POSTCODE; formInsert.DESTINATION_TEL_NO = param.DESTINATION_TEL_NO; formInsert.DESTINATION_FAX = param.DESTINATION_FAX; db.MST_DESTINATION.Add(formInsert); log.Info("Insert Data form MST_DESTINATION" + " DESTINATION_ID : " + formInsert.DESTINATION_ID + " DESTINATION_NAME : " + formInsert.DESTINATION_NAME + " DESTINATION_ADDRESS : " + formInsert.DESTINATION_ADDRESS + " DESTINATION_DISTRICT : " + formInsert.DESTINATION_DISTRICT + " DESTINATION_AMPHURE : " + formInsert.DESTINATION_AMPHURE + " DESTINATION_PROVINCE : " + formInsert.DESTINATION_PROVINCE + " DESTINATION_POSTCODE : " + formInsert.DESTINATION_POSTCODE + " DESTINATION_TEL_NO : " + formInsert.DESTINATION_TEL_NO + " DESTINATION_FAX : " + formInsert.DESTINATION_FAX ); } } else if (flagAddEdit.Equals("E")) { if (Util.isNotEmpty(formUpdate)) { formUpdate.DESTINATION_ID = param.DESTINATION_ID; formUpdate.DESTINATION_NAME = param.DESTINATION_NAME; formUpdate.DESTINATION_ADDRESS = param.DESTINATION_ADDRESS; formUpdate.DESTINATION_DISTRICT = param.DESTINATION_DISTRICT; formUpdate.DESTINATION_AMPHURE = param.DESTINATION_AMPHURE; formUpdate.DESTINATION_PROVINCE = param.DESTINATION_PROVINCE; formUpdate.DESTINATION_POSTCODE = param.DESTINATION_POSTCODE; formUpdate.DESTINATION_TEL_NO = param.DESTINATION_TEL_NO; formUpdate.DESTINATION_FAX = param.DESTINATION_FAX; log.Info("Update Data form MST_DESTINATION" + " DESTINATION_ID : " + formUpdate.DESTINATION_ID + " DESTINATION_NAME : " + formUpdate.DESTINATION_NAME + " DESTINATION_ADDRESS : " + formUpdate.DESTINATION_ADDRESS + " DESTINATION_DISTRICT : " + formUpdate.DESTINATION_DISTRICT + " DESTINATION_AMPHURE : " + formUpdate.DESTINATION_AMPHURE + " DESTINATION_PROVINCE : " + formUpdate.DESTINATION_PROVINCE + " DESTINATION_POSTCODE : " + formUpdate.DESTINATION_POSTCODE + " DESTINATION_TEL_NO : " + formUpdate.DESTINATION_TEL_NO + " DESTINATION_FAX : " + formUpdate.DESTINATION_FAX ); } } db.SaveChanges(); msgError.statusFlag = MsgForm.STATUS_SUCCESS; } } catch (Exception ex) { log.Error(ex.ToString(), ex); msgError.statusFlag = MsgForm.STATUS_ERROR; msgError.messageDescription = ex.ToString(); } finally { log.Info("End log INFO... insertOrUpdateDataMstDestination"); } return(new object[] { msgError, formUpdate }); }
public frmSupSettle() { InitializeComponent(); // Helper.GlobalData.InitForm(this); // var tb = new DataTable(); tb.Columns.Add("select_flag"); tb.Columns.Add("path"); tb.Columns.Add("voucher_no"); tb.Columns.Add("voucher_first"); tb.Columns.Add("sheet_amount", typeof(decimal)); tb.Columns.Add("paid_amount", typeof(decimal)); tb.Columns.Add("paid_free", typeof(decimal)); tb.Columns.Add("yf_amount", typeof(decimal)); tb.Columns.Add("pay_amount", typeof(decimal)); tb.Columns.Add("pay_free", typeof(decimal)); tb.Columns.Add("pay_date", typeof(DateTime)); tb.Columns.Add("memo"); tb.Columns.Add("voucher_type"); editGrid1.AddColumn("select_flag", "核销", "", 50, 2, "", false); editGrid1.AddColumn("path", "方向", "", 50, 2, "{-1:-,1:+}", false); editGrid1.AddColumn("voucher_no", "业务单号", "", 150, 1, "", false); editGrid1.AddColumn("voucher_first", "业务类型", "", 90, 2, IvyTransFunction.tran_no_str, false); editGrid1.AddColumn("sheet_amount", "单据金额", "", 100, 3, "0.00", false); editGrid1.AddColumn("paid_amount", "已付金额", "", 100, 3, "0.00", false); editGrid1.AddColumn("paid_free", "已免付金额", "", 100, 3, "0.00", false); editGrid1.AddColumn("yf_amount", "应付金额", "", 100, 3, "0.00", false); editGrid1.AddColumn("pay_amount", "本次付款金额", "", 120, 3, "0.00", true); editGrid1.AddColumn("pay_free", "免付金额", "", 100, 3, "0.00", true); editGrid1.AddColumn("pay_date", "限付日期", "", 100, 3, "yyyy-MM-dd", false); editGrid1.AddColumn("memo", "备注", "", 180, 1, "", true); editGrid1.AddColumn("voucher_type", "业务描述", "", 100, 1, "", false); editGrid1.SetTotalColumn("pay_amount,pay_free"); editGrid1.BindCheck("select_flag"); editGrid1.DataSource = tb; // try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // System.Threading.Thread th = new System.Threading.Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { BLL.SupFY bll = new BLL.SupFY(); var sup = bll.GetSupList(); this.txtsup.Invoke((MethodInvoker) delegate { this.txtsup.Bind(sup, 300, 200, "supcust_no", "supcust_no:货商编码:100,sup_name:货商名称:150", "supcust_no/sup_name->Text"); }); IBLL.IPayment paymentBLL = new BLL.PaymentBLL(); var pay_way = paymentBLL.GetAllList(); this.txtpay_way.Invoke((MethodInvoker) delegate { txtpay_way.Bind(pay_way, 300, 200, "pay_way", "pay_way:付款代码:100,pay_name:付款方式:100", "pay_way/pay_name->Text"); txtpay_way.GetDefaultValue(); }); var visa = bll.GetBankList(); this.txtvisa.Invoke((MethodInvoker) delegate { txtvisa.Bind(visa, 300, 200, "visa_id", "visa_id:编号:100,visa_nm:名称:130", "visa_id/visa_nm->Text"); txtvisa.GetDefaultValue(); }); var branch = bll.GetBranchList(); this.txtbranch.Invoke((MethodInvoker) delegate { txtbranch.Bind(branch, 300, 200, "branch_no", "branch_no:机构号:80,branch_name:机构名:140", "branch_no/branch_name->Text"); }); IBLL.IPeople peopleBLL = new BLL.PeopleBLL(); int tmp; var people = peopleBLL.GetDataTable("", "", 1, 1, 20000, out tmp); this.txtpeople.Invoke((MethodInvoker) delegate { txtpeople.Bind(people, 250, 200, "oper_id", "oper_id:职员编号:80,oper_name:姓名:80", "oper_id/oper_name->Text"); txtpeople.GetDefaultValue(); }); this.Invoke((MethodInvoker) delegate { IOrder ins = this; ins.Add(); }); } catch (Exception ex) { IvyBack.Helper.LogHelper.writeLog("frmSupSettle", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } 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); } }
private void refreshData() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // DateTime date1; DateTime date2; DateTime.TryParse(dateTextBox1.Text.Trim(), out date1); DateTime.TryParse(dateTextBox2.Text.Trim(), out date2); string text = myTextBox1.Text.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(); if (date1 == DateTime.MinValue) { throw new Exception("期间不正确"); } if (date2 == DateTime.MinValue) { throw new Exception("期间不正确"); } DataTable tb = bll.GetList(date1, date2, text); this.dataGrid1.Invoke((MethodInvoker) delegate { this.dataGrid1.DataSource = tb; if (tb.Rows.Count > 0) { sheet_no = tb.Rows[0]["sheet_no"].ToString(); System.Data.DataTable tb1; System.Data.DataTable tb2; bll.GetOrder(sheet_no, out tb1, out tb2); this.dataGrid2.DataSource = tb2; this.dataGrid2.Refresh(); } }); } catch (Exception ex) { IvyBack.Helper.LogHelper.writeLog("refreshData", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
public frmCashOrder() { InitializeComponent(); Helper.GlobalData.InitForm(this); try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.IPayment paymentBLL = new BLL.PaymentBLL(); var pay_way_tb = paymentBLL.GetAllList(); this.txtpay_way.Invoke((MethodInvoker) delegate { this.txtpay_way.Bind(pay_way_tb, 300, 200, "pay_way", "pay_way:类型编码:100,pay_name:付款类型:150", "pay_way/pay_name->Text"); }); IBLL.IBank bankBLL = new BLL.BankBLL(); var bank_tb = bankBLL.GetAllList(); this.txtpay_way.Invoke((MethodInvoker) delegate { this.txtvisa.Bind(bank_tb, 300, 200, "visa_id", "visa_id:编号:100,visa_nm:名称:130", "visa_id/visa_nm->Text"); }); var bank_tb2 = bankBLL.GetAllList(); this.txtvisa2.Invoke((MethodInvoker) delegate { txtvisa2.Bind(bank_tb2, 300, 200, "visa_id", "visa_id:编号:100,visa_nm:名称:130", "visa_id/visa_nm->Text"); }); IBLL.IBranch branchBLL = new BLL.BranchBLL(); var branch_tb = branchBLL.GetAllList(4); this.txtbranch.Invoke((MethodInvoker) delegate { txtbranch.Bind(branch_tb, 300, 200, "branch_no", "branch_no:机构号:80,branch_name:机构名:140", "branch_no/branch_name->Text"); }); IBLL.IPeople peopleBLL = new BLL.PeopleBLL(); int tmp; var people_tb = peopleBLL.GetDataTable("", "", 1, 1, 20000, out tmp); this.txtpeople.Invoke((MethodInvoker) delegate { txtpeople.Bind(people_tb, 250, 200, "oper_id", "oper_id:职员编号:80,oper_name:姓名:80", "oper_id/oper_name->Text"); }); this.Invoke((MethodInvoker) delegate { IOrder ins = this; ins.Add(); }); } catch (Exception ex) { LogHelper.writeLog("frmCashOrder", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); Cursor.Current = Cursors.Default; }); th.Start(); } 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 (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; } }
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.ShowOrder(string sheet_no) { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // RunType = 2; IBLL.ICashOrder bll = new BLL.CashOrder(); DataTable tb1; bll.GetOrder(sheet_no, out tb1); // // var r1 = tb1.Rows[0]; if (r1["pay_way"].ToString() == "") { txtpay_way.Text = ""; } else { txtpay_way.Text = r1["pay_way"].ToString() + "/" + r1["pay_name"].ToString(); } if (r1["branch_no"].ToString() == "") { txtbranch.Text = ""; } else { txtbranch.Text = r1["branch_no"].ToString() + "/" + r1["branch_name"].ToString(); } txtsheet_no.Text = r1["sheet_no"].ToString(); txtoper_date.Text = Helper.Conv.ToDateTime(r1["oper_date"].ToString()).ToString("yyyy-MM-dd"); if (r1["deal_man"].ToString() == "") { txtpeople.Text = ""; } else { txtpeople.Text = r1["deal_man"].ToString() + "/" + r1["deal_man_name"].ToString(); } if (r1["approve_man"].ToString() == "") { txtapprove_man.Text = ""; } else { txtapprove_man.Text = r1["approve_man"].ToString() + "/" + r1["approve_man_name"].ToString(); } if (r1["oper_id"].ToString() == "") { txtoper_man.Text = ""; } else { txtoper_man.Text = r1["oper_id"] + "/" + r1["oper_name"]; } txtmemo.Text = r1["other1"].ToString(); DateTime dt; if (DateTime.TryParse(r1["approve_date"].ToString(), out dt) == true) { txtapprove_date.Text = dt.ToString("yyyy-MM-dd"); } else { txtapprove_date.Text = ""; } txtold_no.Text = r1["voucher_no"].ToString(); if (r1["visa_id"].ToString() == "") { txtvisa.Text = ""; } else { txtvisa.Text = r1["visa_id"].ToString() + "/" + r1["visa_name"].ToString(); } if (r1["visa_in"].ToString() == "") { txtvisa2.Text = ""; } else { txtvisa2.Text = r1["visa_in"].ToString() + "/" + r1["bank_in_name"].ToString(); } txtcash.Text = Helper.Conv.ToDecimal(r1["bill_total"].ToString()).ToString("0.00"); // Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Conv.ControlsAdds(this, dic); } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
public frmOtherInOutSheet() { InitializeComponent(); // Helper.GlobalData.InitForm(this); // var tb = new DataTable(); tb.Columns.Add("item_no"); tb.Columns.Add("item_subno"); tb.Columns.Add("barcode"); tb.Columns.Add("item_name"); tb.Columns.Add("unit_no"); tb.Columns.Add("item_size"); tb.Columns.Add("other3"); tb.Columns.Add("stock_qty", typeof(decimal)); tb.Columns.Add("in_qty", typeof(decimal)); tb.Columns.Add("valid_price", typeof(decimal)); tb.Columns.Add("discount", typeof(decimal)); tb.Columns.Add("sub_amount", typeof(decimal)); tb.Columns.Add("other1"); tb.Columns.Add("valid_date", typeof(DateTime)); tb.Columns.Add("price", typeof(decimal));//参考进价 editGrid1.AddColumn("item_subno", "货号", "", 100, 1, "", true); editGrid1.AddColumn("item_name", "商品名称", "", 150, 1, "", false); editGrid1.AddColumn("unit_no", "单位", "", 60, 2, "", false); editGrid1.AddColumn("item_size", "规格", "", 80, 1, "", false); editGrid1.AddColumn("stock_qty", "库存", "", 80, 3, "0.00", false); editGrid1.AddColumn("in_qty", "数量", "", 80, 3, "0.00", true); editGrid1.AddColumn("valid_price", "单价", "", 100, 3, "0.00", true); editGrid1.AddColumn("sub_amount", "金额", "", 100, 3, "0.00", false); //editGrid1.AddColumn("", "特价", "", 100, 3, "0.00", true); editGrid1.AddColumn("other1", "备注", "", 150, 1, "", true); //editGrid1.AddColumn("", "生产批号", "", 120, 3, "0.00", true); //editGrid1.AddColumn("", "库位", "", 120, 3, "0.00", true); editGrid1.AddColumn("price", "参考进价", "", 100, 3, "0.00", false); editGrid1.SetTotalColumn("in_qty,sub_amount");//合计项 editGrid1.DataSource = tb; // try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // System.Threading.Thread th = new System.Threading.Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICommonBLL bll2 = new BLL.CommonBLL(); // var branch = bll2.GetBranchList(); this.txtbranch.Invoke((MethodInvoker) delegate { txtbranch.Bind(branch, 300, 200, "branch_no", "branch_no:编号:80,branch_name:名称:140", "branch_no/branch_name->Text"); }); DataTable dt2 = new DataTable(); dt2.Columns.Add("trans_no"); dt2.Columns.Add("trans_name"); dt2.Rows.Add("01", "其它入库"); dt2.Rows.Add("02", "归还"); dt2.Rows.Add("03", "其它出库"); dt2.Rows.Add("04", "领用出库"); dt2.Rows.Add("05", "报损出库"); dt2.Rows.Add("06", "借出"); dt2.Rows.Add("07", "报溢入库"); dt2.Rows.Add("09", "库存调整"); this.txt_trans_no.Invoke((MethodInvoker) delegate { txt_trans_no.Bind(dt2, 250, 200, "trans_no", "trans_no:编码:80,trans_name:业务类型:100", "trans_no/trans_name->Text"); }); var deal = bll2.GetPeopleList(); this.txt_deal_man.Invoke((MethodInvoker) delegate { txt_deal_man.Bind(deal, 250, 200, "oper_id", "oper_id:编号:80,oper_name:姓名:100", "oper_id/oper_name->Text"); }); this.Invoke((MethodInvoker) delegate { IOrder ins = this; ins.Add(); }); } catch (Exception ex) { IvyBack.Helper.LogHelper.writeLog("frmOtherInOutSheet", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmOtherInOutSheet()", ex.ToString()); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }