Пример #1
0
        private void mnuPurchaseList_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (DBGrid.CurrentRow == null)
                {
                    return;
                }

                modCustomerOrderList mod = (modCustomerOrderList)DBGrid.CurrentRow.DataBoundItem;
                dalPurchaseList      dal = new dalPurchaseList();
                BindingCollection <modVPurchaseDetail> list = dal.GetVDetail(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, mod.ProductId, string.Empty, mod.CustOrderNo, string.Empty, string.Empty, out Util.emsg);
                if (list != null && list.Count > 0)
                {
                    frmViewList frm = new frmViewList();
                    frm.InitViewList(clsTranslate.TranslateString("Purchase List"), list);
                    frm.ShowDialog();
                }
                else
                {
                    MessageBox.Show(clsTranslate.TranslateString("No data found!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #2
0
        protected void LoadData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                string statuslist = "9";
                if (chkNotAudit.Checked)
                {
                    statuslist += ",0";
                }
                if (chkAudited.Checked)
                {
                    statuslist += ",1";
                }

                string paystatuslist = string.Empty;
                if (chkPay0.Checked)
                {
                    paystatuslist += ",0";
                }
                if (chkPay1.Checked)
                {
                    paystatuslist += ",1";
                }

                string invoicestatuslist = string.Empty;
                if (chkInvoice0.Checked)
                {
                    invoicestatuslist += ",0";
                }
                if (chkInvoice1.Checked)
                {
                    invoicestatuslist += ",1";
                }
                if (chkInvoice2.Checked)
                {
                    invoicestatuslist += ",2";
                }

                string vendorlist = string.Empty;
                if (lstVendor.SelectedItems.Count > 0 && lstVendor.SelectedItems.Count < lstVendor.Items.Count)
                {
                    for (int i = 0; i < lstVendor.SelectedItems.Count; i++)
                    {
                        modVendorList mod = (modVendorList)lstVendor.SelectedItems[i];
                        if (i == 0)
                        {
                            vendorlist = mod.VendorName;
                        }
                        else
                        {
                            vendorlist += "," + mod.VendorName;
                        }
                    }
                }

                BindingCollection <modVPurchaseDetail> list = _dal.GetVDetail(statuslist, cboPurchaseType.SelectedValue.ToString(), vendorlist, string.Empty, txtInvNo.Text.Trim(), paystatuslist, invoicestatuslist, string.Empty, string.Empty, txtProductName.Text.Trim(), string.Empty, dtpFrom.Text, dtpTo.Text, out Util.emsg);
                DBGrid.DataSource = list;
                decimal sum = 0;
                if (list != null && list.Count > 0)
                {
                    foreach (modVPurchaseDetail mod in list)
                    {
                        sum += mod.Qty * mod.Price;
                    }
                    ShowColor();
                    StatusLabel1.Text = "共 " + list.Count.ToString() + " 行数据, 合计金额为: " + string.Format("{0:C2}", sum);
                }
                else
                {
                    if (!string.IsNullOrEmpty(Util.emsg))
                    {
                        MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(clsTranslate.TranslateString("No data found!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    StatusLabel1.Text = "共 0 行数据, 合计金额为: " + string.Format("{0:C2}", sum);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #3
0
        private void DBGrid_DoubleClick(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            string statuslist = "9";

            if (chkNotAudit.Checked)
            {
                statuslist += ",0";
            }
            if (chkAudited.Checked)
            {
                statuslist += ",1";
            }

            string paystatuslist = string.Empty;

            if (chkPay0.Checked)
            {
                paystatuslist += ",0";
            }
            if (chkPay1.Checked)
            {
                paystatuslist += ",1";
            }

            string invoicestatuslist = string.Empty;

            if (chkInvoice0.Checked)
            {
                invoicestatuslist += ",0";
            }
            if (chkInvoice1.Checked)
            {
                invoicestatuslist += ",1";
            }
            if (chkInvoice2.Checked)
            {
                invoicestatuslist += ",2";
            }

            string vendorlist = string.Empty;

            if (lstVendor.SelectedItems.Count > 0 && lstVendor.SelectedItems.Count < lstVendor.Items.Count)
            {
                for (int i = 0; i < lstVendor.SelectedItems.Count; i++)
                {
                    modVendorList mod = (modVendorList)lstVendor.SelectedItems[i];
                    if (i == 0)
                    {
                        vendorlist = mod.VendorName;
                    }
                    else
                    {
                        vendorlist += "," + mod.VendorName;
                    }
                }
            }

            BindingCollection <modVPurchaseDetail> list = new BindingCollection <modVPurchaseDetail>();

            if (DBGrid.CurrentRow.Index == DBGrid.RowCount - 1)
            {
                list = _dal.GetVDetail(statuslist, cboPurchaseType.SelectedValue.ToString(), vendorlist, string.Empty, string.Empty, paystatuslist, invoicestatuslist, string.Empty, string.Empty, string.Empty, string.Empty, dtpFrom.Text, dtpTo.Text, out Util.emsg);
            }
            else
            {
                modPurchaseSummary moditem = (modPurchaseSummary)DBGrid.CurrentRow.DataBoundItem;
                list = _dal.GetVDetail(string.Empty, moditem.PurchaseType, moditem.VendorName, string.Empty, string.Empty, paystatuslist, invoicestatuslist, moditem.Currency, string.Empty, string.Empty, string.Empty, dtpFrom.Text, dtpTo.Text, out Util.emsg);
            }
            if (list != null && list.Count > 0)
            {
                frmViewList frm = new frmViewList();
                frm.InitViewList(clsTranslate.TranslateString("Purchase List"), list);
                frm.ShowDialog();
            }
        }