Ejemplo n.º 1
0
        private void btnProduct_Click(object sender, EventArgs e)
        {
            dalWarehouseProductInout dal = new dalWarehouseProductInout();
            BindingCollection <modProductSizeWip> list = dal.GetProductSizeWip(Util.modperiod.AccName, out Util.emsg);
            frmViewList frm = new frmViewList();

            frm.InitViewList("请选择产品及尺寸:", list);
            frm.Selection = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                dalProductList dalpdt = new dalProductList();
                modProductList modpdt = dalpdt.GetItem(Util.retValue1, out Util.emsg);
                txtProductId.Text   = Util.retValue1;
                txtProductName.Text = Util.retValue2;
                txtSize.Text        = Util.retValue3;
                if (modpdt.SizeFlag == 1)
                {
                    txtSize.Enabled = true;
                }
                else
                {
                    txtSize.Enabled = false;
                }
                txtQty.Focus();
            }
        }
Ejemplo n.º 2
0
 private void txtProductId_Validated(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtProductId.Text.Trim()) && string.IsNullOrEmpty(txtProductName.Text.Trim()))
     {
         dalProductList dalpdt = new dalProductList();
         modProductList modpdt = dalpdt.GetItem(txtProductId.Text.Trim(), out Util.emsg);
         if (modpdt != null)
         {
             //txtProductId.Text = Util.retValue1;
             txtProductName.Text = modpdt.ProductName;
             if (modpdt.SizeFlag == 1)
             {
                 txtSize.Enabled = true;
                 txtSize.Text    = "0";
             }
             else
             {
                 txtSize.Enabled = false;
                 txtSize.Text    = "1";
             }
             txtQty.Focus();
         }
         else
         {
             MessageBox.Show("该产品编号不存在!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtProductId.Focus();
         }
     }
 }
Ejemplo n.º 3
0
        private void btnProduct_Click(object sender, EventArgs e)
        {
            MTN_PRODUCT_LIST frm = new MTN_PRODUCT_LIST();

            frm.SelectVisible = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                dalProductList dalpdt = new dalProductList();
                modProductList modpdt = dalpdt.GetItem(Util.retValue1, out Util.emsg);
                txtProductName.Tag  = modpdt.ProductId;
                txtProductName.Text = modpdt.ProductName;
                txtUnitNo.Text      = modpdt.UnitNo;
                if (modpdt.SizeFlag == 1)
                {
                    txtSize.Enabled = true;
                    txtSize.Text    = "0";
                }
                else
                {
                    txtSize.Enabled = false;
                    txtSize.Text    = "1";
                }
                txtQty.Focus();
            }
        }
Ejemplo n.º 4
0
 public void EditItem(int id)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         _action     = "EDIT";
         FillControl.FillWarehouseInoutType(cboInoutType, 0, false, true);
         modWarehouseInoutForm mod = _dal.GetItem(id, out Util.emsg);
         if (mod != null)
         {
             txtId.Text                 = id.ToString();
             dtpInoutDate.Value         = mod.InoutDate;
             cboInoutType.SelectedValue = mod.InoutType;
             txtNo.Text                 = mod.No;
             txtProductId.Text          = mod.ProductId;
             txtProductName.Text        = mod.ProductName;
             txtSize.Text               = mod.Size.ToString();
             txtQty.Text                = mod.Qty.ToString();
             txtWarehouseId.Text        = mod.WarehouseId.ToString();
             txtRemark.Text             = mod.Remark;
             if (mod.Status == 1)
             {
                 status4.Image = Properties.Resources.audited;
                 Util.ChangeStatus(this, true);
                 toolSave.Enabled = false;
             }
             else
             {
                 status4.Image    = null;
                 toolSave.Visible = true;
                 Util.ChangeStatus(this, false);
                 txtId.ReadOnly   = true;
                 toolSave.Enabled = true;
             }
             dalProductList dalpdt = new dalProductList();
             modProductList modpdt = dalpdt.GetItem(mod.ProductId, out Util.emsg);
             if (modpdt.SizeFlag == 1)
             {
                 txtSize.Enabled = true;
             }
             else
             {
                 txtSize.Enabled = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 5
0
        public static int GetProductSizeFlag(string productid)
        {
            dalProductList dal = new dalProductList();
            modProductList mod = dal.GetItem(productid, out Util.emsg);

            if (mod != null)
            {
                return(mod.SizeFlag);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 6
0
 private void mnuAdd_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         MTN_PRODUCT_LIST frm = new MTN_PRODUCT_LIST();
         frm.SelectVisible = true;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             dalProductList dal = new dalProductList();
             modProductList mod = dal.GetItem(Util.retValue1, out Util.emsg);
             if (mod != null)
             {
                 DataGridViewRow row = new DataGridViewRow();
                 row.CreateCells(DBGrid);
                 row.Cells[0].Value = mod.ProductId;
                 row.Cells[1].Value = mod.ProductName;
                 row.Cells[2].Value = mod.Specify;
                 row.Cells[3].Value = mod.UnitNo;
                 row.Cells[4].Value = mod.Brand;
                 row.Cells[5].Value = 1;
                 row.Cells[6].Value = 0;
                 row.Cells[7].Value = "";
                 row.Height         = 40;
                 DBGrid.Rows.Add(row);
                 row.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 7
0
        private void toolExport_Click(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }

            IList <modExcelRangeData> list = new List <modExcelRangeData>();

            decimal        summny      = 0;
            string         custid      = string.Empty;
            string         custorderno = string.Empty;
            dalProductList dalpdt      = new dalProductList();

            if (DBGrid.SelectedRows.Count == 0)
            {
                for (int i = 0; i < DBGrid.RowCount; i++)
                {
                    if (DBGrid.Rows[i].Visible)
                    {
                        modCustomerOrderList modd = (modCustomerOrderList)DBGrid.Rows[i].DataBoundItem;
                        if (string.IsNullOrEmpty(custid))
                        {
                            dalCustomerList dalcust = new dalCustomerList();
                            modCustomerList modcust = dalcust.GetItem(modd.CustId, out Util.emsg);

                            custid      = modd.CustId;
                            custorderno = modd.CustOrderNo;
                            list.Add(new modExcelRangeData(modcust.FullName, "B6", "E6"));
                            list.Add(new modExcelRangeData(modd.CustOrderNo, "I6", "I6"));
                            list.Add(new modExcelRangeData(modd.FormDate.ToString("yyyy年MM月dd日"), "I7", "I7"));
                        }
                        else
                        {
                            if (custid != modd.CustId)
                            {
                                MessageBox.Show("您所选的订单必须属于同一个客户!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                            if (custorderno != modd.CustOrderNo)
                            {
                                if (MessageBox.Show("您所选的订单不是同一个订单编号,是否要继续?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.No)
                                {
                                    return;
                                }
                            }
                        }
                        string col = (10 + i).ToString().Trim();
                        list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "B" + col));
                        modProductList modpdt = dalpdt.GetItem(modd.ProductId, out Util.emsg);
                        if (modpdt != null)
                        {
                            list.Add(new modExcelRangeData(modpdt.Brand, "C" + col, "C" + col));
                        }
                        list.Add(new modExcelRangeData(modd.Qty.ToString(), "D" + col, "D" + col));
                        list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "G" + col, "G" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "H" + col, "H" + col));
                        list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));

                        summny = modd.Qty * modd.Price;
                    }
                }
                list.Add(new modExcelRangeData("金额大写:" + clsMoney.ConvertToMoney(Convert.ToDouble(summny)), "A23", "I23"));
                list.Add(new modExcelRangeData(string.Format("{0:C2}", summny), "H22", "H22"));
            }
            else
            {
                for (int i = 0; i < DBGrid.SelectedRows.Count; i++)
                {
                    if (DBGrid.SelectedRows[i].Visible)
                    {
                        modCustomerOrderList modd = (modCustomerOrderList)DBGrid.SelectedRows[i].DataBoundItem;
                        if (string.IsNullOrEmpty(custid))
                        {
                            dalCustomerList dalcust = new dalCustomerList();
                            modCustomerList modcust = dalcust.GetItem(modd.CustId, out Util.emsg);

                            custid      = modd.CustId;
                            custorderno = modd.CustOrderNo;
                            list.Add(new modExcelRangeData(modcust.FullName, "B6", "E6"));
                            list.Add(new modExcelRangeData(modd.CustOrderNo, "I6", "I6"));
                            list.Add(new modExcelRangeData(modd.FormDate.ToString("yyyy年MM月dd日"), "I7", "I7"));
                        }
                        else
                        {
                            if (custid != modd.CustId)
                            {
                                MessageBox.Show("您所选的订单必须属于同一个客户!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                            if (custorderno != modd.CustOrderNo)
                            {
                                if (MessageBox.Show("您所选的订单不是同一个订单编号,是否要继续?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.No)
                                {
                                    return;
                                }
                            }
                        }
                        string col = (10 + i).ToString().Trim();
                        list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "B" + col));
                        modProductList modpdt = dalpdt.GetItem(modd.ProductId, out Util.emsg);
                        if (modpdt != null)
                        {
                            list.Add(new modExcelRangeData(modpdt.Brand, "C" + col, "C" + col));
                        }
                        list.Add(new modExcelRangeData(modd.Qty.ToString(), "D" + col, "D" + col));
                        list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "G" + col, "G" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "H" + col, "H" + col));
                        list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));

                        summny = modd.Qty * modd.Price;
                    }
                }
                list.Add(new modExcelRangeData("金额大写:" + clsMoney.ConvertToMoney(Convert.ToDouble(summny)), "A23", "I23"));
                list.Add(new modExcelRangeData(string.Format("{0:C2}", summny), "H22", "H22"));
            }
            clsExport.ExportByTemplate(list, "购销合同", 1, 38, 9, 1);
        }
Ejemplo n.º 8
0
        private void txtProduct_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter) || e.KeyChar == Convert.ToChar(Keys.Space))
            {
                dalProductSalePrice dalprice            = new dalProductSalePrice();
                dalProductList      dal                 = new dalProductList();
                BindingCollection <modProductList> list = dal.GetIListByBarcode(txtProduct.Text.Trim(), out Util.emsg);
                if (list != null && list.Count > 0)
                {
                    if (list.Count == 1)
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(DBGrid);

                        row.Height         = 40;
                        row.Cells[0].Value = list[0].ProductId;
                        row.Cells[1].Value = list[0].ProductName;
                        row.Cells[2].Value = list[0].Barcode;
                        row.Cells[3].Value = list[0].UnitNo;
                        row.Cells[4].Value = 1;
                        row.Cells[5].Value = dalprice.GetDefaultPrice(list[0].ProductId, out Util.emsg);
                        row.Cells[6].Value = decimal.Parse(row.Cells[5].Value.ToString());
                        row.Cells[8].Value = list[0].Specify;
                        DBGrid.Rows.Add(row);
                        row.Dispose();
                    }
                    else
                    {
                        frmViewList frm = new frmViewList();
                        frm.InitViewList("请选择商品:", list);
                        frm.Selection = true;
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            var             modPdt = list.Where(c => c.ProductId == Util.retValue1).First();
                            DataGridViewRow row    = new DataGridViewRow();
                            row.CreateCells(DBGrid);

                            row.Height         = 40;
                            row.Cells[0].Value = modPdt.ProductId;
                            row.Cells[1].Value = modPdt.ProductName;
                            row.Cells[2].Value = modPdt.Barcode;
                            row.Cells[3].Value = modPdt.UnitNo;
                            row.Cells[4].Value = 1;
                            row.Cells[5].Value = dalprice.GetDefaultPrice(modPdt.ProductId, out Util.emsg);
                            row.Cells[6].Value = decimal.Parse(row.Cells[5].Value.ToString());
                            row.Cells[8].Value = modPdt.Specify;
                            DBGrid.Rows.Add(row);
                            row.Dispose();
                        }
                    }
                    SumData();
                }
                else
                {
                    modProductList mod = dal.GetItem(txtProduct.Text.Trim(), out Util.emsg);
                    if (mod != null)
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(DBGrid);

                        row.Height         = 40;
                        row.Cells[0].Value = mod.ProductId;
                        row.Cells[1].Value = mod.ProductName;
                        row.Cells[2].Value = mod.Barcode;
                        row.Cells[3].Value = mod.UnitNo;
                        row.Cells[4].Value = 1;
                        row.Cells[5].Value = dalprice.GetDefaultPrice(mod.ProductId, out Util.emsg);
                        row.Cells[6].Value = decimal.Parse(row.Cells[5].Value.ToString());
                        row.Cells[8].Value = mod.Specify;
                        DBGrid.Rows.Add(row);
                        row.Dispose();

                        SumData();
                    }
                    else
                    {
                        MessageBox.Show("没有找到商品!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                if (DBGrid.RowCount > 0)
                {
                    DBGrid.CurrentCell = DBGrid.Rows[DBGrid.RowCount - 1].Cells[4];
                }
                txtProduct.Text = string.Empty;
                txtProduct.Focus();
            }
        }
Ejemplo n.º 9
0
        private void toolExport_Click(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            frmSingleSelect frm = new frmSingleSelect();

            frm.InitData("请选择导出单据类别:", "送货单,购销合同", "送货单", ComboBoxStyle.DropDownList);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                IList <modExcelRangeData> list = new List <modExcelRangeData>();
                modSalesShipment          mod  = (modSalesShipment)DBGrid.CurrentRow.DataBoundItem;
                BindingCollection <modSalesShipmentDetail> listdetail = _dal.GetDetail(mod.ShipId, out Util.emsg);
                dalCustomerList dalcust = new dalCustomerList();
                modCustomerList modcust = dalcust.GetItem(mod.CustId, out Util.emsg);
                switch (Util.retValue1)
                {
                case "送货单":
                case "收营单":
                    string company = clsLxms.GetParameterValue("COMPANY_NAME");
                    switch (company)
                    {
                    case "深圳市蓝图净化用品有限公司":
                        list.Add(new modExcelRangeData("№ " + mod.ShipNo, "H6", "I6"));
                        list.Add(new modExcelRangeData(modcust.FullName, "C7", "E7"));
                        list.Add(new modExcelRangeData(modcust.Tel, "G7", "I7"));
                        list.Add(new modExcelRangeData(modcust.Linkman, "C8", "E8"));
                        list.Add(new modExcelRangeData(modcust.Fax, "G8", "I8"));
                        list.Add(new modExcelRangeData(mod.ShipAddr, "C9", "I9"));

                        list.Add(new modExcelRangeData(mod.CustOrderNo, "A13", "C13"));
                        list.Add(new modExcelRangeData(modcust.PayMethod, "D13", "E13"));
                        dalAdminEmployeeList dalemp = new dalAdminEmployeeList();
                        modAdminEmployeeList modemp = dalemp.GetItem(mod.SalesMan, out Util.emsg);
                        if (modemp != null)
                        {
                            list.Add(new modExcelRangeData(modemp.EmployeeName, "F13", "F13"));
                        }
                        else
                        {
                            list.Add(new modExcelRangeData(mod.SalesMan, "F13", "F13"));
                        }
                        list.Add(new modExcelRangeData(mod.ShipDate.ToString("yyyy年MM月dd日"), "G13", "G13"));

                        for (int i = 0; i < listdetail.Count; i++)
                        {
                            modSalesShipmentDetail modd = listdetail[i];
                            string col = (17 + i).ToString().Trim();
                            list.Add(new modExcelRangeData((i + 1).ToString(), "A" + col, "A" + col));
                            list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "C" + col));
                            list.Add(new modExcelRangeData(modd.Specify, "D" + col, "D" + col));
                            list.Add(new modExcelRangeData(modd.Qty.ToString(), "E" + col, "E" + col));
                            list.Add(new modExcelRangeData(modd.UnitNo, "F" + col, "F" + col));
                            list.Add(new modExcelRangeData(modd.Price.ToString("#,##0.00"), "G" + col, "G" + col));
                            list.Add(new modExcelRangeData((modd.Qty * modd.Price).ToString("#,##0.00"), "H" + col, "H" + col));
                            list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));
                        }
                        clsExport.ExportByTemplate(list, "蓝图送货单", 1, 24, 10, 1);
                        break;

                    default:
                        list.Add(new modExcelRangeData(clsLxms.GetParameterValue("COMPANY_NAME"), "A1", "L1"));
                        list.Add(new modExcelRangeData("TEL:" + clsLxms.GetParameterValue("COMPANY_TEL") + "  Fax:" + clsLxms.GetParameterValue("COMPANY_FAX"), "A2", "L2"));
                        list.Add(new modExcelRangeData("公司地址:" + clsLxms.GetParameterValue("COMPANY_ADDR"), "A3", "L3"));
                        if (mod.InvoiceStatus >= 1)
                        {
                            list.Add(new modExcelRangeData("S", "L4", "L4"));
                        }
                        list.Add(new modExcelRangeData(mod.ShipType, "E4", "I5"));
                        list.Add(new modExcelRangeData(mod.CustOrderNo, "C4", "D4"));
                        list.Add(new modExcelRangeData(modcust.FullName, "C5", "D5"));
                        list.Add(new modExcelRangeData(mod.ShipAddr, "C6", "D6"));
                        list.Add(new modExcelRangeData(modcust.Linkman + " " + modcust.Tel, "K4", "K4"));
                        list.Add(new modExcelRangeData(mod.ShipNo, "K5", "K5"));
                        list.Add(new modExcelRangeData(mod.ShipDate.ToString("yyyy年MM月dd日"), "K6", "K6"));
                        list.Add(new modExcelRangeData("合计金额:" + clsMoney.ConvertToMoney(Convert.ToDouble(mod.DetailSum + mod.OtherMny - mod.KillMny)), "A16", "I17"));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", mod.DetailSum + mod.OtherMny - mod.KillMny), "J16", "K16"));
                        list.Add(new modExcelRangeData("付款方式:" + mod.PayMethod, "J17", "K17"));
                        list.Add(new modExcelRangeData(Util.UserName, "K20", "K20"));

                        for (int i = 0; i < listdetail.Count; i++)
                        {
                            modSalesShipmentDetail modd = listdetail[i];
                            string col = (8 + i).ToString().Trim();
                            list.Add(new modExcelRangeData((i + 1).ToString(), "A" + col, "A" + col));
                            list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "D" + col));
                            list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                            list.Add(new modExcelRangeData(modd.Qty.ToString(), "F" + col, "G" + col));
                            list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "H" + col, "I" + col));
                            list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "J" + col, "J" + col));
                            list.Add(new modExcelRangeData(modd.Remark, "K" + col, "K" + col));
                        }
                        clsExport.ExportByTemplate(list, "送货单", 1, 20, 11, 1);
                        break;
                    }
                    break;

                case "购销合同":
                    list.Add(new modExcelRangeData(modcust.FullName, "B6", "E6"));
                    list.Add(new modExcelRangeData(mod.ShipNo, "I6", "I6"));
                    list.Add(new modExcelRangeData(mod.ShipDate.ToString("yyyy年MM月dd日"), "I7", "I7"));
                    list.Add(new modExcelRangeData("金额大写:" + clsMoney.ConvertToMoney(Convert.ToDouble(mod.DetailSum + mod.OtherMny - mod.KillMny)), "A23", "I23"));
                    list.Add(new modExcelRangeData(string.Format("{0:C2}", mod.DetailSum + mod.OtherMny - mod.KillMny), "H22", "H22"));

                    dalProductList dalpdt = new dalProductList();
                    for (int i = 0; i < listdetail.Count; i++)
                    {
                        modSalesShipmentDetail modd = listdetail[i];
                        string col = (10 + i).ToString().Trim();
                        //list.Add(new modExcelRangeData((i+1).ToString(), "A" + col, "A" + col));
                        list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "B" + col));
                        modProductList modpdt = dalpdt.GetItem(modd.ProductId, out Util.emsg);
                        if (modpdt != null)
                        {
                            list.Add(new modExcelRangeData(modpdt.Brand, "C" + col, "C" + col));
                        }
                        list.Add(new modExcelRangeData(modd.Qty.ToString(), "D" + col, "D" + col));
                        list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "G" + col, "G" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "H" + col, "H" + col));
                        list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));
                    }
                    clsExport.ExportByTemplate(list, "购销合同", 1, 38, 9, 1);
                    break;
                }
            }
        }