示例#1
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;
        }
示例#2
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);
            }
        }
示例#3
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();
            }
        }
示例#4
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;
            }
        }
示例#5
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;
            }
        }