Пример #1
0
 private void tsbCheck_Click(object sender, EventArgs e)
 {
     try
     {
         if (!MyLove.PermissionsBalidation(this.Text, "05"))
         {
             return;
         }
         if (this.dataGrid1.CurrentRow() != null)
         {
             string      sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString();
             IBLL.ICusFY bll      = new BLL.CusFY();
             bll.Check(sheet_no, Program.oper.oper_id);
             var row = this.dataGrid1.CurrentRow();
             row["approve_flag"] = "1";
             row["approve_man"]  = Program.oper.oper_id;
             row["approve_date"] = System.DateTime.Now;
             this.dataGrid1.Refresh();
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom(ex);
     }
 }
Пример #2
0
 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.ICusFY bll = new BLL.CusFY();
                 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);
     }
 }
Пример #3
0
 public frmCusFYList()
 {
     InitializeComponent();
     //
     Helper.GlobalData.InitForm(this);
     //
     dataGrid1.AddColumn("sheet_no", "费用单号", "", 130, 1, "");
     dataGrid1.AddColumn("cus_no", "客户编号", "", 80, 1, "");
     dataGrid1.AddColumn("cus_name", "客户名称", "", 150, 1, "");
     dataGrid1.AddColumn("branch_no_a", "发生机构", "", 130, 1, "");
     dataGrid1.AddColumn("old_no", "原始单号", "", 130, 1, "");
     dataGrid1.AddColumn("sale_man_a", "经办人", "", 100, 1, "");
     dataGrid1.AddColumn("approve_man_a", "审核人", "", 110, 1, "");
     dataGrid1.AddColumn("approve_date", "审核日期", "", 100, 1, "yyyy-MM-dd");
     dataGrid1.AddColumn("oper_id_a", "操作员", "", 100, 1, "");
     dataGrid1.AddColumn("oper_date", "操作日期", "", 100, 1, "yyyy-MM-dd");
     dataGrid1.DataSource = new DataTable();
     //
     dataGrid2.AddColumn("kk_no", "费用代码", "", 90, 1, "");
     dataGrid2.AddColumn("kk_name", "费用名称", "", 150, 1, "");
     dataGrid2.AddColumn("kk_cash", "费用(金额)", "", 100, 3, "0.00");
     dataGrid2.AddColumn("pay_kind", "应收增减", "", 80, 2, "{0:-,1:+}");
     dataGrid2.AddColumn("other1", "备注", "", 150, 1, "");
     dataGrid2.DataSource = new DataTable();
     //
     this.dateTextBox1.Text = System.DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
     this.dateTextBox2.Text = System.DateTime.Now.ToString("yyyy-MM-dd");
     BLL.CusFY bll = new BLL.CusFY();
     this.myTextBox1.Bind(bll.GetCusList(), 300, 200, "supcust_no", "supcust_no:客户编码:100,sup_name:客户名称:150",
                          "supcust_no/sup_name->Text");
 }
Пример #4
0
        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.ICusFY bll = new BLL.CusFY();
                        bll.Delete(sheet_no);
                        IOrder ins = this;
                        ins.Add();
                    }
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Пример #5
0
        public void GetPrintTb()
        {
            if (string.IsNullOrEmpty(this.txtsheet_no.Text))
            {
                throw new Exception("请选择单据!");
            }

            IBLL.ICusFY bll = new BLL.CusFY();
            DataTable   tb1;
            DataTable   tb2;

            bll.GetOrder(this.txtsheet_no.Text, out tb1, out tb2);

            PrintForm.PrintHelper.tb_main   = tb1;
            PrintForm.PrintHelper.tb_detail = tb2;
        }
Пример #6
0
        private void dataGrid1_CurrentCellChange(object sender, string column_name, DataRow row)
        {
            try
            {
                if (sheet_no != row["sheet_no"].ToString())
                {
                    System.Threading.Thread th = new System.Threading.Thread(() =>
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        Helper.GlobalData.windows.ShowLoad(this);
                        try
                        {
                            sheet_no        = row["sheet_no"].ToString();
                            IBLL.ICusFY bll = new BLL.CusFY();
                            System.Data.DataTable tb1;
                            System.Data.DataTable tb2;
                            bll.GetOrder(sheet_no, out tb1, out tb2);

                            this.dataGrid2.Invoke((MethodInvoker) delegate
                            {
                                this.dataGrid2.DataSource = tb2;
                            });
                        }
                        catch (Exception ex)
                        {
                            IvyBack.Helper.LogHelper.writeLog("dataGrid1_CurrentCellChange", ex.ToString());
                            MsgForm.ShowFrom(ex);
                        }
                        Cursor.Current = Cursors.Default;
                        Helper.GlobalData.windows.CloseLoad(this);
                    });
                    th.Start();
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Пример #7
0
 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.ICusFY bll      = new BLL.CusFY();
             bll.Check(sheet_no, Program.oper.oper_id);
             IOrder ins = this;
             ins.ShowOrder(sheet_no);
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom(ex);
     }
 }
Пример #8
0
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var         kv  = r.ToDictionary();
                IBLL.ICusFY bll = new BLL.CusFY();
                if (t == "get_list")
                {
                    DateTime date1  = Helper.Conv.ToDateTime(r.Read("date1"));
                    DateTime date2  = Helper.Conv.ToDateTime(r.Read("date2"));
                    string   cus_no = r.Read("cus_no");
                    var      tb     = bll.GetList(date1, date2, cus_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);

                    res = w.ToString();
                }
                else if (t == "get_order")
                {
                    string sheet_no = r.Read("sheet_no");
                    System.Data.DataTable tb1;
                    System.Data.DataTable tb2;
                    bll.GetOrder(sheet_no, out tb1, out tb2);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("tb1", tb1);
                    w.Append("tb2", tb2);
                    res = w.ToString();
                }
                else if (t == "max_code")
                {
                    string code = bll.MaxCode();
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("code", code);
                    res = w.ToString();
                }
                else if (t == "add")
                {
                    Model.rp_t_supcust_fy_master ord = new Model.rp_t_supcust_fy_master();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.supcust_no   = r.Read("supcust_no");
                    ord.supcust_flag = r.Read("supcust_flag");
                    ord.pay_type     = r.Read("pay_type");
                    ord.pay_date     = System.DateTime.Now;
                    ord.old_no       = r.Read("old_no");
                    ord.oper_id      = r.Read("oper_id");
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.approve_flag = "0";
                    ord.approve_man  = "";
                    ord.approve_date = System.DateTime.MinValue;
                    ord.is_payed     = r.Read("is_payed");
                    ord.sale_man     = r.Read("sale_man");
                    ord.branch_no    = r.Read("branch_no");
                    ord.cm_branch    = r.Read("cm_branch");
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.num1         = Helper.Conv.ToDecimal(r.Read("num1"));
                    ord.num2         = Helper.Conv.ToDecimal(r.Read("num2"));
                    ord.num3         = Helper.Conv.ToDecimal(r.Read("num3"));
                    ord.visa_id      = r.Read("visa_id");
                    ord.is_over      = r.Read("is_over");
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.paid_amount  = Helper.Conv.ToDecimal(r.Read("paid_amount"));
                    ord.pay_way      = r.Read("pay_way");
                    ord.pay_name     = r.Read("pay_name");
                    List <Model.rp_t_supcust_fy_detail> lines = new List <Model.rp_t_supcust_fy_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        Model.rp_t_supcust_fy_detail line = new Model.rp_t_supcust_fy_detail();
                        lines.Add(line);
                        line.sheet_no = ord.sheet_no;
                        line.kk_no    = r2.Read("kk_no");
                        line.kk_cash  = Helper.Conv.ToDecimal(r2.Read("kk_cash"));
                        line.other1   = r2.Read("other1");
                        line.other2   = r2.Read("other2");
                        line.other3   = r2.Read("other3");
                        line.num1     = Helper.Conv.ToDecimal(r2.Read("num1"));
                        line.num2     = Helper.Conv.ToDecimal(r2.Read("num2"));
                        line.num3     = Helper.Conv.ToDecimal(r2.Read("num3"));
                    }
                    string sheet_no;
                    bll.Add(ord, lines, out sheet_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("sheet_no", sheet_no);

                    res = w.ToString();
                }
                else if (t == "change")
                {
                    Model.rp_t_supcust_fy_master ord = new Model.rp_t_supcust_fy_master();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.supcust_no   = r.Read("supcust_no");
                    ord.supcust_flag = r.Read("supcust_flag");
                    ord.pay_type     = r.Read("pay_type");
                    ord.pay_date     = System.DateTime.Now;
                    ord.old_no       = r.Read("old_no");
                    ord.oper_id      = r.Read("oper_id");
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.approve_flag = "0";
                    ord.approve_man  = "";
                    ord.approve_date = System.DateTime.MinValue;
                    ord.is_payed     = r.Read("is_payed");
                    ord.sale_man     = r.Read("sale_man");
                    ord.branch_no    = r.Read("branch_no");
                    ord.cm_branch    = r.Read("cm_branch");
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.num1         = Helper.Conv.ToDecimal(r.Read("num1"));
                    ord.num2         = Helper.Conv.ToDecimal(r.Read("num2"));
                    ord.num3         = Helper.Conv.ToDecimal(r.Read("num3"));
                    ord.visa_id      = r.Read("visa_id");
                    ord.is_over      = r.Read("is_over");
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.paid_amount  = Helper.Conv.ToDecimal(r.Read("paid_amount"));
                    ord.pay_way      = r.Read("pay_way");
                    ord.pay_name     = r.Read("pay_name");
                    List <Model.rp_t_supcust_fy_detail> lines = new List <Model.rp_t_supcust_fy_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        Model.rp_t_supcust_fy_detail line = new Model.rp_t_supcust_fy_detail();
                        lines.Add(line);
                        line.sheet_no = ord.sheet_no;
                        line.kk_no    = r2.Read("kk_no");
                        line.kk_cash  = Helper.Conv.ToDecimal(r2.Read("kk_cash"));
                        line.other1   = r2.Read("other1");
                        line.other2   = r2.Read("other2");
                        line.other3   = r2.Read("other3");
                        line.num1     = Helper.Conv.ToDecimal(r2.Read("num1"));
                        line.num2     = Helper.Conv.ToDecimal(r2.Read("num2"));
                        line.num3     = Helper.Conv.ToDecimal(r2.Read("num3"));
                    }
                    bll.Change(ord, lines);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete")
                {
                    string sheet_no = r.Read("sheet_no");
                    bll.Delete(sheet_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "check")
                {
                    string sheet_no    = r.Read("sheet_no");
                    string approve_man = r.Read("approve_man");
                    bll.Check(sheet_no, approve_man);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else
                {
                    throw new Exception("未找到方法" + t);
                }
            }
            catch (Exception ex)
            {
                ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                w.Append("errId", "-1");
                w.Append("errMsg", ex.Message);
                LogHelper.writeLog("", ex.ToString());
                res = w.ToString();
            }
        }
Пример #9
0
        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.ICusFY bll = new BLL.CusFY();

                        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;
                            }
                        });
                    }
                    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;
            }
        }
Пример #10
0
        public frmCusSettle()
        {
            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.DataSource = tb;

            editGrid1.BindCheck("select_flag");
            //
            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.CusFY bll = new BLL.CusFY();
                        var cus       = bll.GetCusList();

                        this.txtcus.Invoke((MethodInvoker) delegate
                        {
                            this.txtcus.Bind(cus, 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("frmCusSettle", 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;
            }
        }
Пример #11
0
        void IOrder.ShowOrder(string sheet_no)
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                RunType = 2;

                IBLL.ICusFY bll = new BLL.CusFY();
                DataTable   tb1;
                DataTable   tb2;
                bll.GetOrder(sheet_no, out tb1, out tb2);
                //

                //
                var r1 = tb1.Rows[0];
                if (r1["cus_no"].ToString() == "")
                {
                    txtcus.Text = "";
                }
                else
                {
                    txtcus.Text = r1["cus_no"].ToString() + "/" + r1["cus_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["sale_man"].ToString() == "")
                {
                    txtpeople.Text = "";
                }
                else
                {
                    txtpeople.Text = r1["sale_man"].ToString() + "/" + r1["sale_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["old_no"].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;
            }
        }
Пример #12
0
        public frmCusFY()
        {
            InitializeComponent();
            //
            Helper.GlobalData.InitForm(this);
            //
            var tb = new DataTable();

            tb.Columns.Add("kk_no");
            tb.Columns.Add("kk_name");
            tb.Columns.Add("kk_cash");
            tb.Columns.Add("pay_kind");
            tb.Columns.Add("other1");

            editGrid1.AddColumn("kk_no", "费用代码", "", 90, 1, "", true);
            editGrid1.AddColumn("kk_name", "费用名称", "", 140, 1, "", false);
            editGrid1.AddColumn("kk_cash", "费用(金额)", "", 100, 3, "0.00", true);
            editGrid1.AddColumn("pay_kind", "应收增减", "", 75, 2, "{0:-,1:+}", false);
            editGrid1.AddColumn("other1", "备注", "", 250, 1, "", true);
            editGrid1.DataSource = tb;
            //
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                Thread th = new Thread(() =>
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        BLL.CusFY bll = new BLL.CusFY();

                        var editgrid = bll.GetSZList();
                        this.editGrid1.Invoke((MethodInvoker) delegate
                        {
                            var edgrid = editgrid.Copy();
                            foreach (DataRow dr in edgrid.Rows)
                            {
                                dr["pay_kind"] = dr["pay_kind"].ToInt32() == 0 ? "-" : "+";
                            }
                            editGrid1.Bind("kk_no", edgrid, 400, 200, "pay_way", "pay_way:费用代码:80,pay_name:费用名称:150,pay_kind:方向:60",
                                           "pay_way->kk_no,pay_name->kk_name,pay_kind->pay_kind");
                        });

                        var cus = bll.GetCusList();
                        this.txtcus.Invoke((MethodInvoker) delegate
                        {
                            this.txtcus.Bind(cus, 300, 200, "supcust_no", "supcust_no:客户编码:100,sup_name:客户名称:150",
                                             "supcust_no/sup_name->Text");
                        });

                        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_tb = bll.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");
                        });

                        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)
                    {
                        LogHelper.writeLog("frmCusFY", 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;
            }
        }
Пример #13
0
        void IOrder.Save()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (txtcus.Text.Trim().Contains("/") == false)
                {
                    throw new Exception("客户必填!");
                }
                if (txtbranch.Text.Trim().Contains("/") == false)
                {
                    throw new Exception("机构必填!");
                }
                if (txtoper_date.Text.Trim() == "")
                {
                    throw new Exception("单据日期必填!");
                }
                this.editGrid1.DataSource.ClearTable("kk_no");
                if (this.editGrid1.DataSource.Rows.Count > 1)
                {
                    throw new Exception("只允许录入一行!");
                }
                Model.rp_t_supcust_fy_master ord = new Model.rp_t_supcust_fy_master();
                ord.sheet_no     = txtsheet_no.Text.Trim();
                ord.supcust_no   = txtcus.Text.Trim().Split('/')[0];
                ord.supcust_flag = "C";

                ord.pay_date     = System.DateTime.Now;
                ord.old_no       = txtold_no.Text.Trim();
                ord.oper_id      = this.txtoper_man.Text.Trim().Split('/')[0];
                ord.oper_date    = Helper.Conv.ToDateTime(this.txtoper_date.Text);
                ord.approve_flag = "0";
                ord.approve_man  = "";
                ord.approve_date = System.DateTime.MinValue;
                ord.is_payed     = "0";
                ord.sale_man     = txtpeople.Text.Trim().Split('/')[0];
                ord.branch_no    = txtbranch.Text.Trim().Split('/')[0];
                ord.cm_branch    = "00";
                ord.other1       = txtmemo.Text.Trim();
                ord.other2       = "";
                ord.other3       = "";
                ord.num1         = 0;
                ord.num2         = 0;
                ord.num3         = 0;
                ord.visa_id      = txtvisa.Text.Trim().Split('/')[0];
                ord.is_over      = "0";
                ord.total_amount = 0;
                ord.paid_amount  = 0;
                ord.pay_way      = "";
                ord.pay_name     = "";
                int flag = 0;
                List <Model.rp_t_supcust_fy_detail> lines = new List <Model.rp_t_supcust_fy_detail>();
                int index = 0;
                foreach (DataRow row in editGrid1.DataSource.Rows)
                {
                    index++;
                    if (row["kk_no"].ToString() != "")
                    {
                        if (Helper.Conv.ToDecimal(row["kk_cash"].ToString()) <= 0)
                        {
                            throw new Exception("第i行费用金额不正确!".Replace("i", index.ToString()));
                        }
                        Model.rp_t_supcust_fy_detail line = new Model.rp_t_supcust_fy_detail();
                        lines.Add(line);
                        line.sheet_no = ord.sheet_no;
                        line.kk_no    = row["kk_no"].ToString();
                        line.kk_cash  = Helper.Conv.ToDecimal(row["kk_cash"].ToString());
                        line.other1   = row["other1"].ToString();

                        line.other2      = "";
                        line.other3      = "";
                        line.num1        = 0;
                        line.num2        = 0;
                        line.num3        = 0;
                        ord.total_amount = line.kk_cash;
                        if (row["pay_kind"].ToString() == "0" || row["pay_kind"].ToString() == "-")
                        {
                            ord.pay_type = "-";
                        }
                        else
                        {
                            ord.pay_type = "+";
                        }
                        flag = 1;
                    }
                }
                if (flag == 0)
                {
                    throw new Exception("表体无合法数据!");
                }
                if (runType == 1)
                {
                    IBLL.ICusFY bll = new BLL.CusFY();
                    string      sheet_no;
                    bll.Add(ord, lines, out sheet_no);
                    IOrder ins = this;
                    ins.ShowOrder(sheet_no);
                }
                else if (runType == 2)
                {
                    IBLL.ICusFY bll = new BLL.CusFY();
                    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;
            }
        }