Ejemplo n.º 1
0
        protected override void ShowSearchForm()
        {
            Query.ConditionXChooseForm f = new Query.ConditionXChooseForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Query.ConditionX condition = f.Condition as Query.ConditionX;
                this.bindingSource1.DataSource = ((BL.InvoiceXOManager)this.invoiceManager).SelectByYJRQCustomEmpCusXOId(condition.Customer1, condition.Customer2, condition.StartDate, condition.EndDate, condition.Yjri1, condition.Yjri2, condition.Employee1, condition.Employee2, condition.XOId1, condition.XOId2, condition.CusXOId, condition.Product, condition.Product2, condition.IsClose, false, false);

            }
            f.Dispose();
            GC.Collect();
            this.barStaticItem1.Caption = string.Format("{0}По", this.bindingSource1.Count);
        }
Ejemplo n.º 2
0
 protected override void ShowSearchForm()
 {
     if (this.tag == 1)
     {
         this.tag = 0;
         return;
     }
     Query.ConditionXChooseForm f = new Query.ConditionXChooseForm();
     if (f.ShowDialog(this) == DialogResult.OK)
     {
         Query.ConditionX con = f.Condition as Query.ConditionX;
         this.bindingSource1.DataSource = ((BL.InvoiceXSManager) this.invoiceManager).SelectDateRangAndWhere(con.Customer1, con.Customer2, con.StartDate, con.EndDate, con.Yjri1, con.Yjri2, con.CusXOId, con.Product, con.XOId1, con.XOId2, con.DepotId, con.HandBookId);
     }
     f.Dispose();
     GC.Collect();
 }
Ejemplo n.º 3
0
 //更改查询条件
 private void btnChangeSearch_Click(object sender, EventArgs e)
 {
     this.RecordSelected();
     Query.ConditionXChooseForm f = new Query.ConditionXChooseForm();
     if (f.ShowDialog(this) == DialogResult.OK)
     {
         Query.ConditionX con = f.Condition as Query.ConditionX;
         this.bsHeader.DataSource = this._mInvoiceXSManager.SelectDateRangAndWhere(con.Customer1, con.Customer2, con.StartDate, con.EndDate, con.Yjri1, con.Yjri2, con.CusXOId, con.Product, con.Product2, con.XOId1, con.XOId2, con.FreightedCompanyId, con.ConveyanceMethodId, con.Employee1, con.Employee2, con.Product_Id, con.ProductCategoryId);
         if (this.bsHeader.Current != null)
         {
             Model.InvoiceXS xs = this.bsHeader.Current as Model.InvoiceXS;
             IList <Model.InvoiceXSDetail> xsd = this._mInvoiceXSDetailManager.Select(xs);
             (this.bsHeader.Current as Model.InvoiceXS).Details = xsd;
             this.bindingSource1.DataSource = (this.bsHeader.Current as Model.InvoiceXS).Details;
         }
     }
     f.Dispose();
     GC.Collect();
 }
Ejemplo n.º 4
0
 protected override void ShowSearchForm()
 {
     if (this.tag == 1)
     {
         this.tag = 0;
         return;
     }
     Query.ConditionXChooseForm f = new Query.ConditionXChooseForm();
     if (f.ShowDialog(this) == DialogResult.OK)
     {
         Query.ConditionX con = f.Condition as Query.ConditionX;
         this.bindingSource1.DataSource = ((BL.InvoiceXSManager) this.invoiceManager).SelectDateRangAndWhere(con.Customer1, con.StartDate, con.EndDate, con.CusXOId, con.Product, null, con.FreightedCompanyId, con.ConveyanceMethodId);
     }
     else
     {
         this.Dispose();
         this.Close();
     }
     this.barStaticItem1.Caption = string.Format("{0}Items", this.bindingSource1.Count);
     f.Dispose();
     GC.Collect();
 }
Ejemplo n.º 5
0
        protected override void ShowSearchForm()
        {
            if (this.tag == 1)
            {
                this.tag = 0;
                return;
            }
            Query.ConditionXChooseForm f = new Query.ConditionXChooseForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Query.ConditionX con      = f.Condition as Query.ConditionX;
                DataTable        dtDetail = new DataTable();

                //this.bindingSource1.DataSource = ((BL.InvoiceXSManager)this.invoiceManager).SelectDateRangAndWhere(con.Customer1, con.Customer2, con.StartDate, con.EndDate, con.Yjri1, con.Yjri2, con.CusXOId, con.Product, con.Product2, con.XOId1, con.XOId2, con.FreightedCompanyId, con.ConveyanceMethodId, con.Employee1, con.Employee2);
                dtDetail = ((BL.InvoiceXSManager) this.invoiceManager).SelectDateRangAndWhereToTable(con.Customer1, con.Customer2, con.StartDate, con.EndDate, con.Yjri1, con.Yjri2, con.CusXOId, con.Product, con.Product2, con.XOId1, con.XOId2, con.FreightedCompanyId, con.ConveyanceMethodId, con.Employee1, con.Employee2, con.Product_Id, con.ProductCategoryId);

                if (dtDetail != null || dtDetail.Rows.Count > 0)
                {
                    dtHeader = dtDetail.Clone();
                    dtHeader.Columns.Add("XSId");

                    for (int i = 0; i < dtDetail.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            DataRow dr = dtHeader.NewRow();
                            dr.ItemArray = dtDetail.Rows[i].ItemArray;
                            dr["CustomerInvoiceXOId"] = "";
                            dtHeader.Rows.Add(dr);
                        }
                        else
                        {
                            if (dtDetail.Rows[i]["InvoiceId"].ToString() == dtDetail.Rows[i - 1]["InvoiceId"].ToString())
                            {
                                dtHeader.Rows[dtHeader.Rows.Count - 1]["XOMoney"] = Convert.ToDecimal(dtHeader.Rows[dtHeader.Rows.Count - 1]["XOMoney"]) + Convert.ToDecimal(dtDetail.Rows[i]["XOMoney"]);
                                dtHeader.Rows[dtHeader.Rows.Count - 1]["XSMoney"] = Convert.ToDecimal(dtHeader.Rows[dtHeader.Rows.Count - 1]["XSMoney"]) + Convert.ToDecimal(dtDetail.Rows[i]["XSMoney"]);
                            }
                            else
                            {
                                DataRow dr = dtHeader.NewRow();
                                dr.ItemArray = dtDetail.Rows[i].ItemArray;
                                dr["CustomerInvoiceXOId"] = "";
                                dtHeader.Rows.Add(dr);
                            }
                        }

                        dtDetail.Rows[i]["Employee0"]   = "";
                        dtDetail.Rows[i]["Customer"]    = "";
                        dtDetail.Rows[i]["Depot"]       = "";
                        dtDetail.Rows[i]["InvoiceDate"] = DBNull.Value;
                        dtDetail.Rows[i]["InvoiceNote"] = "";
                    }

                    DataSet ds = new DataSet();
                    ds.Tables.Add(dtHeader);
                    ds.Tables.Add(dtDetail);

                    ds.Relations.Add(dtHeader.Columns["InvoiceId"], dtDetail.Columns["InvoiceId"]);

                    this.gridView1.OptionsDetail.ShowDetailTabs = false;
                    this.gridControl1.DataSource = this.bindingSource1.DataSource = dtHeader;
                    this.gridControl1.RefreshDataSource();
                }
            }
            else
            {
                this.Dispose();
                this.Close();
            }
            this.barStaticItem1.Caption = string.Format("{0}По", this.bindingSource1.Count);
            f.Dispose();
            GC.Collect();
        }
Ejemplo n.º 6
0
        public ROHistoryXS()
        {
            InitializeComponent();

            Query.ConditionXChooseForm f = new Query.ConditionXChooseForm();
            if (f.ShowDialog() == DialogResult.OK)
            {
                Query.ConditionX con = f.Condition as Query.ConditionX;

                IList <Model.InvoiceXS> list = new BL.InvoiceXSManager().SelectDateRangAndWhere(con.Customer1, con.Customer2, con.StartDate, con.EndDate, con.Yjri1, con.Yjri2, con.CusXOId, con.Product, con.Product2, con.XOId1, con.XOId2, con.FreightedCompanyId, con.ConveyanceMethodId, con.Employee1, con.Employee2, con.Product_Id, con.ProductCategoryId);

                if (list == null || list.Count == 0)
                {
                    MessageBox.Show("無數據", "提示", MessageBoxButtons.OK);
                }

                IList <Model.InvoiceXSDetail> listDetail = new List <Model.InvoiceXSDetail>();
                foreach (var item in list)
                {
                    item.Details = detailManager.Select(item);
                    foreach (var detail in item.Details)
                    {
                        detail.Invoice = item;
                        listDetail.Add(detail);
                    }
                }

                var group = listDetail.GroupBy(D => D.InvoiceNO);
                IList <Model.InvoiceXSDetail> details = new List <Model.InvoiceXSDetail>();

                if (group != null && group.Count() > 0)
                {
                    foreach (var item in group)
                    {
                        Model.InvoiceXSDetail detail = new Book.Model.InvoiceXSDetail();
                        detail = item.First();
                        //先计算台幣金額,然后加总金额,因为台幣金額=金额*汇率
                        detail.TaibiAmountForGroup  = item.Sum(D => D.TaibiAmount);
                        detail.InvoiceXSDetailMoney = item.Sum(D => D.InvoiceXSDetailMoney);
                        item.Select(D => D.InvoiceXO.CustomerInvoiceXOId).Distinct().ToList().ForEach(F =>
                        {
                            detail.CusXOIdForGroup += F + "\r\n";
                        });
                        detail.CusXOIdForGroup = detail.CusXOIdForGroup.TrimEnd(new char[] { '\r', '\n' });

                        details.Add(detail);
                    }
                }

                this.DataSource = details;

                this.lbl_CompanyName.Text = BL.Settings.CompanyChineseName;
                this.lbl_ReportName.Text  = "銷售表 sales report";
                this.lbl_ReportDate.Text  = con.StartDate.ToString("yyyy-MM-dd") + " ~ " + con.EndDate.ToString("yyyy-MM-dd");

                string currenty = Model.ExchangeRate.GetCurrencyENNameAndSign(listDetail[0].Currency);

                this.xrTableCell9.Text = string.Format("實際請款     ({0})", currenty);

                this.TCInvoiceDate.DataBindings.Add("Text", this.DataSource, "Invoice." + Model.InvoiceXS.PROPERTY_INVOICEDATE, "{0:yyyy/MM/dd}");
                this.TCDeclareDate.DataBindings.Add("Text", this.DataSource, "Invoice." + Model.InvoiceXS.PRO_DeclareDate, "{0:yyyy/MM/dd}");
                this.TCShipMethod.DataBindings.Add("Text", this.DataSource, "Invoice.ConveyanceMethod." + Model.ConveyanceMethod.PROPERTY_CONVEYANCEMETHODNAME);
                this.TCXSCustomer.DataBindings.Add("Text", this.DataSource, "Invoice.XSCustomer." + Model.Customer.PRO_CustomerFullName);
                this.TCInvoiceNO.DataBindings.Add("Text", this.DataSource, Model.InvoiceXSDetail.PRO_InvoiceNO);
                this.TCAmount.DataBindings.Add("Text", this.DataSource, Model.InvoiceXSDetail.PRO_InvoiceXSDetailMoney, currenty + "{0:N2}");
                this.TCRealAmount.DataBindings.Add("Text", this.DataSource, Model.InvoiceXSDetail.PRO_InvoiceXSDetailMoney, currenty + "{0:N2}");
                this.TCExchangeRate.DataBindings.Add("Text", this.DataSource, Model.InvoiceXSDetail.PRO_ExchangeRate);
                //this.TCTaibiAmount.DataBindings.Add("Text", this.DataSource, "TaibiAmount", "NT${0:N2}");
                this.TCTaibiAmount.DataBindings.Add("Text", this.DataSource, "TaibiAmountForGroup", "NT${0:N2}");
                this.TCPayTerm.DataBindings.Add("Text", this.DataSource, "Invoice.XSCustomer." + Model.Customer.PRO_PayCondition);
                //this.TCCusXOId.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerInvoiceXOId);
                //this.TCCusXOId.DataBindings.Add("Text", this.DataSource, "CusXOIdForGroup");
                this.xrRichText1.DataBindings.Add("Text", this.DataSource, "CusXOIdForGroup");

                this.TCTotalAmount.Text      = currenty + details.Sum(D => D.InvoiceXSDetailMoney).Value.ToString("N2");
                this.TCTotalTaibiAmount.Text = "NT$" + details.Sum(D => D.TaibiAmountForGroup).Value.ToString("N2");
            }
            else
            {
                throw new Exception();
            }
        }