private bool AddInvoiceMx()
        {
            FinanceManagerSys.Model.InvoiceMX_Model model = new FinanceSys.FinanceManagerSys.Model.InvoiceMX_Model();
            FinanceManagerSys.BLL.InvoiceMX_BLL     mxbll = new FinanceSys.FinanceManagerSys.BLL.InvoiceMX_BLL();
            model.DemoName    = this.txtDemoname.Text.Trim();
            model.EmpName     = this.cbxEmp.Text;
            model.Handling    = this.txtHandling.Text.Trim();
            model.InvoiceNo   = this.txtInvoiceno.Text.Trim();
            model.Invoicetime = DateTime.Now;
            model.LTDName     = this.txtB.Text.Trim();
            model.Money       = decimal.Parse(this.txtMoney.Text.Trim());
            model.Payment     = cbxPayment.Text;
            model.Remark      = this.txtRemark.Text.Trim();
            model.Status      = this.cbxStatus.Text;
            model.IsBank      = "";

            if (mxbll.Add(model) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public void Load_InvoiceXX(string contractno)
        {
            FinanceManagerSys.BLL.InvoiceMX_BLL mxbll = new FinanceSys.FinanceManagerSys.BLL.InvoiceMX_BLL();
            DataTable dt = mxbll.GetList(contractno);

            dgvInvoiceMX.AutoGenerateColumns = false;
            dgvInvoiceMX.DataSource          = dt;
        }
 InvoiceMX_Model InvoiceMX()
 {
     FinanceManagerSys.BLL.InvoiceMX_BLL     mx      = new FinanceSys.FinanceManagerSys.BLL.InvoiceMX_BLL();
     FinanceManagerSys.Model.InvoiceMX_Model mxmodel = new FinanceSys.FinanceManagerSys.Model.InvoiceMX_Model();
     mxmodel.DemoName    = this.txtDemoname.Text.Trim();
     mxmodel.EmpName     = this.cbxEmp.Text;
     mxmodel.Handling    = this.txtHandling.Text.Trim();
     mxmodel.InvoiceNo   = this.txtInvoiceno.Text.Trim();
     mxmodel.ContractNo  = this.txtContractno.Text.Trim();
     mxmodel.Invoicetime = DateTime.Now;
     mxmodel.LTDName     = this.txtB.Text.Trim();
     mxmodel.Money       = decimal.Parse(this.txtInvoiceMoney.Text.Trim());
     mxmodel.Payment     = cbxPayment.Text;
     mxmodel.Remark      = this.txtRemark.Text.Trim();
     mxmodel.Status      = this.cbxStatus.Text;
     mxmodel.IsBank      = "";
     return(mxmodel);
 }
        /// <summary>
        /// 新增
        /// </summary>
        /// <returns></returns>
        private bool AddInvoice()
        {
            FinanceManagerSys.Model.Invoice_Model model = new FinanceSys.FinanceManagerSys.Model.Invoice_Model();
            FinanceManagerSys.BLL.InvoiceMX_BLL   mx    = new FinanceSys.FinanceManagerSys.BLL.InvoiceMX_BLL();
            model.DemoName    = this.txtDemoname.Text.Trim();
            model.EmpName     = this.cbxEmp.Text;
            model.Handling    = this.txtHandling.Text.Trim();
            model.InvoiceNo   = this.txtInvoiceno.Text.Trim();
            model.ContractNo  = this.txtContractno.Text.Trim();
            model.Invoicetime = DateTime.Now;
            model.LTDName     = this.txtB.Text.Trim();
            model.Money       = decimal.Parse(this.txtInvoiceMoney.Text.Trim());
            model.Payment     = cbxPayment.Text;
            model.Remark      = this.txtRemark.Text.Trim();
            model.Status      = this.cbxStatus.Text;
            model.IsBank      = "";
            int item = App_Code.Canshu.Id;

            if (invoicebll.GetIsCount(item))
            {
                if (mx.Add(this.InvoiceMX()) > 0)
                {
                    UpdateInvoice();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                //根据状态画图标开始
                switch (cbxStatus.Text)
                {
                    #region 未付
                case "未付":
                    PictureBox pi = new PictureBox();
                    pi.Image    = global::FinanceSys.Properties.Resources.orange;
                    pi.Location = new System.Drawing.Point(wi, hei);

                    pi.Name     = "pic1";
                    pi.Size     = new System.Drawing.Size(35, 35);
                    pi.TabIndex = 11;
                    pi.TabStop  = false;

                    Label lb1 = new Label();
                    lb1.Text     = "名称:" + this.txtB.Text.Trim();
                    lb1.Size     = new System.Drawing.Size(35, 15);
                    lb1.Location = new System.Drawing.Point(wi, hei + pi.Height + 3);


                    Label lbl1 = new Label();
                    lbl1.Text     = "金额:";
                    lbl1.Text    += this.txtInvoiceMoney.Text.Trim();
                    lbl1.Size     = new System.Drawing.Size(115, 15);
                    lbl1.Location = new System.Drawing.Point(pi.Location.X, hei + pi.Height + 15 + lbl1.Height);

                    this.dgvInfo.Controls.Add(lb1);
                    this.dgvInfo.Controls.Add(lbl1);
                    this.dgvInfo.Controls.Add(pi);

                    if (wi + pi.Width >= this.groupBox2.Width - 100)
                    {
                        hei += 83;
                        wi   = 5;
                    }
                    else
                    {
                        wi += 50;
                    }
                    break;

                    #endregion
                    #region 未付完
                case "未付完":
                    PictureBox pi2 = new PictureBox();
                    pi2.Image    = global::FinanceSys.Properties.Resources.yellow;
                    pi2.Location = new System.Drawing.Point(wi, hei);

                    pi2.Name     = "pic2";
                    pi2.Size     = new System.Drawing.Size(35, 35);
                    pi2.TabIndex = 11;
                    pi2.TabStop  = false;


                    Label lb12 = new Label();
                    lb12.Text     = "名称:" + this.txtB.Text.Trim();
                    lb12.Size     = new System.Drawing.Size(35, 15);
                    lb12.Location = new System.Drawing.Point(wi, hei + pi2.Height + 3);


                    Label lb2 = new Label();
                    lb2.Text     = "金额:";
                    lb2.Text    += this.txtInvoiceMoney.Text.Trim();
                    lb2.Size     = new System.Drawing.Size(115, 15);
                    lb2.Location = new System.Drawing.Point(pi2.Location.X, hei + pi2.Height + 15 + lb2.Height);

                    this.dgvInfo.Controls.Add(lb12);
                    this.dgvInfo.Controls.Add(lb2);
                    this.dgvInfo.Controls.Add(pi2);

                    if (wi + pi2.Width >= this.groupBox2.Width - 100)
                    {
                        hei += 83;
                        wi   = 5;
                    }
                    else
                    {
                        wi += 50;
                    }
                    break;

                    #endregion
                    #region 已付完
                case "已付完":
                    PictureBox pi3 = new PictureBox();
                    pi3.Image    = (Image)global::FinanceSys.Properties.Resources.red;
                    pi3.Location = new System.Drawing.Point(wi, hei);

                    pi3.Name     = "pic3";
                    pi3.Size     = new System.Drawing.Size(35, 35);
                    pi3.TabIndex = 11;
                    pi3.TabStop  = false;

                    Label lb13 = new Label();
                    lb13.Text     = "名称:" + this.txtB.Text.Trim();
                    lb13.Size     = new System.Drawing.Size(35, 15);
                    lb13.Location = new System.Drawing.Point(wi, hei + pi3.Height + 3);

                    Label lb4 = new Label();
                    lb4.Text     = "金额:";
                    lb4.Text    += this.txtInvoiceMoney.Text.Trim();
                    lb4.Size     = new System.Drawing.Size(115, 15);
                    lb4.Location = new System.Drawing.Point(pi3.Location.X, hei + pi3.Height + 15 + lb4.Height);

                    this.dgvInfo.Controls.Add(lb13);
                    this.dgvInfo.Controls.Add(lb4);
                    this.dgvInfo.Controls.Add(pi3);

                    if (wi + pi3.Width >= this.groupBox2.Width - 100)
                    {
                        hei += 83;
                        wi   = 5;
                    }
                    else
                    {
                        wi += 50;
                    }
                    break;

                default:
                    break;
                    #endregion
                }
                if (invoicebll.Add(model) > 0)
                {
                    mx.Add(this.InvoiceMX());
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }