コード例 #1
0
 private void btn_InvoiceCGId3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (e.Button.Index == 0)
     {
         Invoices.CG.SearchCGDetail f = new Book.UI.Invoices.CG.SearchCGDetail();
         if (f.ShowDialog(this) == DialogResult.OK)
         {
             if (f.selectItems != null && f.selectItems.Count > 0)
             {
                 this.btn_InvoiceCGId3.EditValue = f.selectItems[0].InvoiceId;
                 this.btn_InvoiceCOId3.EditValue = f.selectItems[0].InvoiceCOId;
             }
         }
     }
     else
     {
         this.btn_InvoiceCGId3.EditValue = null;
         this.btn_InvoiceCOId3.EditValue = null;
     }
 }
コード例 #2
0
        //#region  选取采购单,改到选取进库单时拉取

        //private void btn_InvoiceCOId_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        //{
        //    Invoices.CG.CGForm f = new Book.UI.Invoices.CG.CGForm();
        //    if (f.ShowDialog(this) == DialogResult.OK)
        //    {
        //        if (f.key != null && f.key.Count > 0)
        //            this.btn_InvoiceCOId1.EditValue = f.key[0].InvoiceId;
        //    }
        //}

        //private void btn_InvoiceCOId2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        //{
        //    Invoices.CG.CGForm f = new Book.UI.Invoices.CG.CGForm();
        //    if (f.ShowDialog(this) == DialogResult.OK)
        //    {
        //        if (f.key != null && f.key.Count > 0)
        //            this.btn_InvoiceCOId2.EditValue = f.key[0].InvoiceId;
        //    }
        //}

        //private void btn_InvoiceCOId3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        //{
        //    Invoices.CG.CGForm f = new Book.UI.Invoices.CG.CGForm();
        //    if (f.ShowDialog(this) == DialogResult.OK)
        //    {
        //        if (f.key != null && f.key.Count > 0)
        //            this.btn_InvoiceCOId3.EditValue = f.key[0].InvoiceId;
        //    }
        //}
        //#endregion

        private void btn_InvoiceCGId1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 0)
            {
                Invoices.CG.SearchCGDetail f = new Book.UI.Invoices.CG.SearchCGDetail();
                if (f.ShowDialog(this) == DialogResult.OK)
                {
                    if (f.selectItems != null && f.selectItems.Count > 0)
                    {
                        this.btn_InvoiceCGId1.EditValue = f.selectItems[0].InvoiceId;
                        this.btn_InvoiceCOId1.EditValue = f.selectItems[0].InvoiceCOId;
                        this.btn_Product.EditValue      = f.selectItems[0].Product;
                        this.nccSupplier.EditValue      = f.selectItems[0].Invoice == null ? null : f.selectItems[0].Invoice.Supplier;
                        this.cobUnit.EditValue          = f.selectItems[0].InvoiceProductUnit;
                    }
                }
            }
            else
            {
                this.btn_InvoiceCGId1.EditValue = null;
                this.btn_InvoiceCOId1.EditValue = null;
            }
        }
コード例 #3
0
ファイル: EditForm.cs プロジェクト: daobataotie/Mobe
        private void btn_add_Click(object sender, EventArgs e)
        {
            //采购单
            //SelectInvoiceCOListForm form = new SelectInvoiceCOListForm();
            //if (form.ShowDialog(this) == DialogResult.OK)
            //{
            //    if (form.SelectItems == null || form.SelectItems.Count == 0)
            //        form.SelectItems.Add(form.SelectItem);
            //    this._acInvoiceCoBill.Details = (this._acInvoiceCoBill.Details.Union((from i in form.SelectItems
            //                                                                          select new Model.AcInvoiceCOBillDetail()
            //                                                                          {
            //                                                                              AcInvoiceCOBillDetailId = Guid.NewGuid().ToString(),
            //                                                                              AcInvoiceCOBillId = this._acInvoiceCoBill.AcInvoiceCOBillId,
            //                                                                              InvoiceId = i.InvoiceId,
            //                                                                              InvoiceCGDetailMoney = i.InvoiceHeji.HasValue ? i.InvoiceHeji.Value : 0,
            //                                                                              InvoiceCGDetailTaxMoney = i.InvoiceTotal.HasValue ? i.InvoiceTotal.Value : 0,
            //                                                                              InvoiceCGDetailTax = i.InvoiceTax.HasValue ? i.InvoiceTax.Value : 0,
            //                                                                          }).ToList<Model.AcInvoiceCOBillDetail>())).ToList<Model.AcInvoiceCOBillDetail>();
            //}
            //this.TaxRateMoney.Value = (from i in this._acInvoiceCoBill.Details select i.InvoiceCGDetailTax.Value).Sum();
            //this.HeJiMoney.Value = (from i in this._acInvoiceCoBill.Details select i.InvoiceCGDetailMoney.Value).Sum();
            //this.ZongMoney.Value = (from i in this._acInvoiceCoBill.Details select i.InvoiceCGDetailTaxMoney.Value).Sum();
            //this.bindingSourceDetails.DataSource = this._acInvoiceCoBill.Details;
            //this.gridControl1.RefreshDataSource();
            //form.Dispose();
            //GC.Collect();
            //进库单
            Invoices.CG.SearchCGDetail f = new Book.UI.Invoices.CG.SearchCGDetail();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (f.selectItems.Count != 0)
                {
                    foreach (Model.InvoiceCGDetail item in f.selectItems)
                    {
                        Model.AcInvoiceCOBillDetail detail = new Book.Model.AcInvoiceCOBillDetail();
                        detail.AcInvoiceCOBillDetailId = Guid.NewGuid().ToString();
                        detail.InvoiceCGDetailId       = item.InvoiceCGDetailId;
                        detail.ProductId                = item.ProductId;
                        detail.Product                  = item.Product;
                        detail.Invoice                  = item.Invoice;
                        detail.InvoiceId                = item.InvoiceId;
                        detail.AcInvoiceCOBillId        = this._acInvoiceCoBill.AcInvoiceCOBillId;
                        detail.InvoiceAllowance         = decimal.Parse((item.InvoiceAllowance == null ? 0 : item.InvoiceAllowance.Value).ToString());
                        detail.InvoiceCGDetaiInQuantity = ((item.InvoiceCGDetailQuantity == null ? 0 : item.InvoiceCGDetailQuantity.Value) - (item.InvoiceCGDetailFPQuantity == null ? 0 : item.InvoiceCGDetailFPQuantity.Value)) < 0 ? 0 : ((item.InvoiceCGDetailQuantity == null ? 0 : item.InvoiceCGDetailQuantity.Value) - (item.InvoiceCGDetailFPQuantity == null ? 0 : item.InvoiceCGDetailFPQuantity.Value));

                        detail.InvoiceCGDetailPrice = item.InvoiceCGDetailPrice == null ? 0 : item.InvoiceCGDetailPrice.Value;
                        //  detail.InvoiceCGDetailMoney = item.InvoiceCGDetailMoney == null ? 0 : item.InvoiceCGDetailMoney.Value;
                        detail.InvoiceCGDetailMoney = global::Helper.DateTimeParse.GetSiSheWuRu(decimal.Parse(detail.InvoiceCGDetaiInQuantity.ToString()) * detail.InvoiceCGDetailPrice.Value - detail.InvoiceAllowance.Value, BL.V.SetDataFormat.XSJEXiao.Value);


                        //detail.InvoiceCGDetailTax = item.InvoiceCGDetailTax == null ? 0 : item.InvoiceCGDetailTax.Value;
                        //detail.InvoiceCGDetailTaxMoney = item.InvoiceCGDetailTaxMoney == null ? 0 : item.InvoiceCGDetailTaxMoney.Value;
                        //detail.InvoiceCGDetailTaxPrice = item.InvoiceCGDetailTaxPrice == null ? 0 : item.InvoiceCGDetailTaxPrice.Value;

                        this._acInvoiceCoBill.Details.Add(detail);
                    }

                    //this.TaxRateMoney.Value = (from i in this._acInvoiceCoBill.Details select i.InvoiceCGDetailTax.Value).Sum();
                    //this.HeJiMoney.Value = (from i in this._acInvoiceCoBill.Details select i.InvoiceCGDetailMoney.Value).Sum();
                    //this.ZongMoney.Value = (from i in this._acInvoiceCoBill.Details select i.InvoiceCGDetailTaxMoney.Value).Sum();
                    //this.calcTaxRate.Value = f.selectItems[0].Invoice == null ? 0 : (f.selectItems[0].Invoice.InvoiceTaxrate == null ? 0 : decimal.Parse(f.selectItems[0].Invoice.InvoiceTaxrate.ToString()));
                    //this.TaxType.SelectedIndex = f.selectItems[0].Invoice == null ? 0 : (f.selectItems[0].Invoice.TaxCaluType == null ? 0 : f.selectItems[0].Invoice.TaxCaluType.Value);
                    this.bindingSourceDetails.DataSource = this._acInvoiceCoBill.Details;
                    this.gridControl1.RefreshDataSource();
                    this.UpdateMoneyFields();
                }
                f.Dispose();
                GC.Collect();
            }
        }
コード例 #4
0
ファイル: EditForm.cs プロジェクト: daobataotie/Jianli-en
        //private void AddDataRows()
        //{
        //    Model.PCOtherCheckDetail pcocDetail = new Book.Model.PCOtherCheckDetail();
        //    pcocDetail.PCOtherCheckDetailId = Guid.NewGuid().ToString();
        //    pcocDetail.PCOtherCheckId = this._PCOtherCheck.PCOtherCheckId;
        //    this._PCOtherCheck.Detail.Add(pcocDetail);

        //    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(pcocDetail);
        //}
        #endregion

        //选择采购入库单据
        private void btnSelectCaiGou_Click(object sender, EventArgs e)
        {
            Book.UI.Invoices.CG.SearchCGDetail cgform = new Book.UI.Invoices.CG.SearchCGDetail();
            if (cgform.ShowDialog() == DialogResult.OK)
            {
                if (cgform.selectItems.Count > 0)
                {
                    BL.InvoiceCOManager mCOM = new Book.BL.InvoiceCOManager();
                    //Model.InvoiceCO co = cgform.Invoice;
                    //清空数据
                    if (this._PCOtherCheck.FromPCType < 0)
                    {
                        this._PCOtherCheck.Detail.Clear();
                    }
                    this._PCOtherCheck.FromPCType = 1;
                    //this.lcDanJuId.Text = "採購入庫單編號:";
                    //对控件进行赋值
                    //this.textInvoiceCusXOId.Text = mCOM.Get(cgform.selectItems[0].InvoiceCOId) == null ? "" : mCOM.Get(cgform.selectItems[0].InvoiceCOId).InvoiceCustomXOId;//客户订单编号
                    this.Ncc_Supplier.EditValue = cgform.selectItems[0].Invoice == null ? null : cgform.selectItems[0].Invoice.Supplier;//厂商

                    //this.textInvoiceCusXOId.Text = cgform.key[0].Invoice.InvoiceCustomXOId;     //客户订单编号
                    //this.Ncc_Supplier.EditValue = cgform.key[0].Invoice.Supplier;               //厂商

                    Model.InvoiceCO co = new Book.Model.InvoiceCO();
                    foreach (Model.InvoiceCGDetail item in cgform.selectItems)
                    {
                        Model.PCOtherCheckDetail detail = new Model.PCOtherCheckDetail();                                //详细
                        detail.PCOtherCheckDetailId = Guid.NewGuid().ToString();                                         //详细本身编号
                        detail.PCOtherCheckId       = this._PCOtherCheck.PCOtherCheckId;                                 //头编号
                        detail.FromInvoiceDetailID  = item.InvoiceCGDetailId;                                            //来源详细本身编号
                        detail.FromInvoiceID        = item.InvoiceId;                                                    //来源详细头编号
                        detail.ProceduresId         = null;                                                              //工序编号
                        detail.Procedures           = null;                                                              //加工
                        detail.ProductId            = item.ProductId;                                                    //商品编号
                        detail.Product = item.Product;                                                                   //品名
                        detail.PCOtherCheckDetailDesc     = item.Product == null ? "" : item.Product.ProductDescription; //说明
                        detail.PCOtherCheckDetailQuantity = 0;                                                           //数量
                        detail.ProductUnit = item.InvoiceProductUnit;                                                    //单位

                        co = mCOM.Get(item.InvoiceCOId);
                        if (co == null)
                        {
                            detail.PerspectiveRate = "";
                            detail.DeliveryDate    = null;
                        }
                        else
                        {
                            try
                            {
                                detail.PerspectiveRate = co.Customer == null ? "" : mCOM.Get(cgform.selectItems[0].InvoiceCOId).Customer.CheckedStandard;//透视率
                            }
                            catch
                            {
                                detail.PerspectiveRate = "";
                            }
                            detail.DeliveryDate = co.InvoiceYjrq;//交期
                        }

                        detail.InQuantity  = item.InvoiceCGDetailQuantity;                      //进厂数量
                        detail.OutQuantity = 0;                                                 //出厂数量
                        detail.Determinant = "";                                                //判定
                        detail.PCOtherCheckDetailFromPC = "1";                                  //来源于 采购入库订单

                        //客户订单编号
                        detail.InvoiceCusXOId = co == null ? "" : co.InvoiceCustomXOId;
                        this._PCOtherCheck.Detail.Add(detail);
                    }
                    this.gridControl1.RefreshDataSource();
                }
            }
            cgform.Dispose();
            GC.Collect();
        }