Ejemplo n.º 1
0
        private void ShowProductInfo()
        {
            RT2008.DAL.Product oItem = RT2008.DAL.Product.Load(_ProductId);
            if (oItem != null)
            {
                cboClass1.Text = oItem.CLASS1;
                cboClass2.Text = oItem.CLASS2;
                cboClass3.Text = oItem.CLASS3;
                cboClass4.Text = oItem.CLASS4;
                cboClass5.Text = oItem.CLASS5;
                cboClass6.Text = oItem.CLASS6;

                txtProductName.Text    = oItem.ProductName;
                txtProductNameChs.Text = oItem.ProductName_Chs;
                txtProductNameCht.Text = oItem.ProductName_Cht;

                txtRemarks.Text = oItem.Remarks;

                // 2013.12.24 paulus: dbo.Prodct 也有對應的 fields
                txtWholesalesPrice.Text     = oItem.WholesalePrice.ToString("n2");
                txtOriginalRetailPrice.Text = oItem.OriginalRetailPrice.ToString("n2");
                txtCurrentRetailPrice.Text  = oItem.RetailPrice.ToString("n2");

                txtRetailDiscount.Text  = oItem.NormalDiscount.ToString("n2");
                txtUnit.Text            = oItem.UOM;
                cboNature.SelectedValue = oItem.NatureId;

                txtStatus_Counter.Text = "";
                txtStatus_Office.Text  = "";

                txtCreatedOn.Text  = DateTimeHelper.DateTimeToString(oItem.CreatedOn, false);
                txtModifiedOn.Text = DateTimeHelper.DateTimeToString(oItem.ModifiedOn, false);
                txtModifiedBy.Text = Common.Staff.GetStaffNumber(oItem.ModifiedBy);

                txtCurrentRetailPrice.Text = oItem.RetailPrice.ToString("n2");
            }
        }
Ejemplo n.º 2
0
        private void SaveProduct(Guid productId)
        {
            RT2008.DAL.Product oProduct = RT2008.DAL.Product.Load(productId);
            if (oProduct != null)
            {
                oProduct.CLASS1 = cboClass1.Text;
                oProduct.CLASS2 = cboClass2.Text;
                oProduct.CLASS3 = cboClass3.Text;
                oProduct.CLASS4 = cboClass4.Text;
                oProduct.CLASS5 = cboClass5.Text;
                oProduct.CLASS6 = cboClass6.Text;

                oProduct.ProductName     = txtProductName.Text;
                oProduct.ProductName_Chs = txtProductNameChs.Text;
                oProduct.ProductName_Cht = txtProductNameCht.Text;
                oProduct.Remarks         = txtRemarks.Text;

                oProduct.NormalDiscount = Convert.ToDecimal((txtRetailDiscount.Text == string.Empty) ? "0" : txtRetailDiscount.Text);
                oProduct.UOM            = txtUnit.Text;
                oProduct.NatureId       = new Guid(cboNature.SelectedValue.ToString());

                // Price
                oProduct.RetailPrice         = Convert.ToDecimal((txtCurrentRetailPrice.Text == string.Empty) ? "0" : txtCurrentRetailPrice.Text);
                oProduct.WholesalePrice      = Convert.ToDecimal((txtWholesalesPrice.Text == string.Empty) ? "0" : txtWholesalesPrice.Text);
                oProduct.OriginalRetailPrice = Convert.ToDecimal((txtOriginalRetailPrice.Text == string.Empty) ? "0" : txtOriginalRetailPrice.Text);
                //oItem.Markup = Convert.ToDecimal((general.txtVendorPrice.Text == string.Empty) ? "0" : general.txtVendorPrice.Text);

                // Download Packets
                oProduct.DownloadToPOS     = chkRetailItem.Checked;
                oProduct.DownloadToCounter = chkCounterItem.Checked;

                oProduct.ModifiedBy = RT2008.DAL.Common.Config.CurrentUserId;
                oProduct.ModifiedOn = DateTime.Now;
                oProduct.Save();
            }
        }
Ejemplo n.º 3
0
        private Guid SaveGeneralInfo(Guid productId)
        {
            Guid result = System.Guid.Empty;

            RT2008.DAL.Product oItem = RT2008.DAL.Product.Load(productId);
            if (oItem != null)
            {
                string         sql      = "ProductId = '" + productId.ToString() + "'";
                ProductRemarks oRemarks = ProductRemarks.LoadWhere(sql);
                if (chkUpdateClass1.Checked)
                {
                    oItem.CLASS1 = cboClass1.Text;
                }
                if (chkUpdateClass2.Checked)
                {
                    oItem.CLASS2 = cboClass2.Text;
                }
                if (chkUpdateClass3.Checked)
                {
                    oItem.CLASS3 = cboClass3.Text;
                }
                if (chkUpdateClass4.Checked)
                {
                    oItem.CLASS4 = cboClass4.Text;
                }
                if (chkUpdateClass5.Checked)
                {
                    oItem.CLASS5 = cboClass5.Text;
                }
                if (chkUpdateClass6.Checked)
                {
                    oItem.CLASS6 = cboClass6.Text;
                }

                if (chkUpdateProductName.Checked)
                {
                    oItem.ProductName = txtProductName.Text;
                }
                if (chkUpdateProductNameChs.Checked)
                {
                    oItem.ProductName_Chs = txtProductNameChs.Text;
                }
                if (chkUpdateProductNameCht.Checked)
                {
                    oItem.ProductName_Cht = txtProductNameCht.Text;
                }
                if (chkUpdateRemarks.Checked)
                {
                    oItem.Remarks = txtRemarks.Text;
                }

                // 2013.12.24 paulus: dbo.Prodct 也有對應的 fields
                if (chkUpdateWholesales.Checked)
                {
                    oItem.WholesalePrice = Convert.ToDecimal((txtWholesalesPrice.Text == string.Empty) ? "0" : txtWholesalesPrice.Text);
                }
                if (chkUpdateOriginalRetail.Checked)
                {
                    oItem.OriginalRetailPrice = Convert.ToDecimal((txtOriginalRetailPrice.Text == string.Empty) ? "0" : txtOriginalRetailPrice.Text);
                }
                if (chkUpdateCurrentRetail.Checked)
                {
                    oItem.RetailPrice = Convert.ToDecimal((txtCurrentRetailPrice.Text == string.Empty) ? "0" : txtCurrentRetailPrice.Text);
                }

                if (chkUpdateRetailDiscount.Checked)
                {
                    oItem.NormalDiscount = Convert.ToDecimal((txtRetailDiscount.Text == string.Empty) ? "0" : txtRetailDiscount.Text);
                }
                if (chkUpdateUnit.Checked)
                {
                    oItem.UOM = txtUnit.Text;
                }
                if (chkUpdateNature.Checked)
                {
                    oItem.NatureId = new Guid(cboNature.SelectedValue.ToString());
                }
                if (chkUpdateVendorItem.Checked)
                {
                    oItem.AlternateItem = txtVendorItemNum.Text;                              // Vendor Item Number
                }
                if (chkUpdateReorderLevel.Checked)
                {
                    oItem.ReorderLevel = Convert.ToDecimal((txtReorderLevel.Text == string.Empty) ? "0" : txtReorderLevel.Text);
                }
                if (chkUpdateReorderQuantiry.Checked)
                {
                    oItem.ReorderQty = Convert.ToDecimal((txtReorderQuantity.Text == string.Empty) ? "0" : txtReorderQuantity.Text);
                }

                //tabDiscountInfo
                if (chkFixedPriceItem.Checked)
                {
                    oItem.FixedPriceItem = (cboFixedPriceItem.SelectedIndex == 1) ? true : false;
                }

                // Download Packets
                oItem.DownloadToPOS     = oRemarks.DownloadToShop;
                oItem.DownloadToCounter = oRemarks.DownloadToCounter;
                if (chkUpdateRetailItem.Checked)
                {
                    oItem.DownloadToPOS = chkRetailItem.Checked;
                }
                if (chkUpdateCounterItem.Checked)
                {
                    oItem.DownloadToCounter = chkCounterItem.Checked;
                }

                // Download Packets
                if (chkRetailItem.Checked)
                {
                    oItem.DownloadToPOS = true;
                }
                if (chkCounterItem.Checked)
                {
                    oItem.DownloadToCounter = true;
                }

                oItem.ModifiedBy = DAL.Common.Config.CurrentUserId;
                oItem.ModifiedOn = DateTime.Now;
                oItem.Save();

                // Appendix / Class
                SaveProductCode(oItem.ProductId,
                                new Guid(cboClass1.SelectedValue.ToString()), new Guid(cboClass2.SelectedValue.ToString()), new Guid(cboClass3.SelectedValue.ToString()),
                                new Guid(cboClass4.SelectedValue.ToString()), new Guid(cboClass5.SelectedValue.ToString()), new Guid(cboClass6.SelectedValue.ToString()));

                // Product Price
                SaveProductSupplement(oItem.ProductId);
                SaveProductPrice(oItem.ProductId);

                // Remarks
                SaveProductRemarks(oItem.ProductId);

                result = oItem.ProductId;
            }
            return(result);
        }
Ejemplo n.º 4
0
        private void LoadGeneralInfo()
        {
            RT2008.DAL.Product oItem = RT2008.DAL.Product.Load(this.ProductId);

            StringBuilder sql = new StringBuilder();

            sql.Append(" STKCODE = '").Append(txtStockCode.Text).Append("' ");
            sql.Append(" AND Appendix1 = '").Append(txtAppendix1.Text).Append("' ");
            sql.Append(" AND Appendix2 = '").Append(txtAppendix2.Text).Append("' ");
            sql.Append(" AND Appendix3 = '").Append(txtAppendix3.Text).Append("' ");

            if (oItem == null)
            {
                oItem = RT2008.DAL.Product.LoadWhere(sql.ToString());
            }

            if (oItem != null)
            {
                this.ProductId = oItem.ProductId;

                txtStockCode.Text = oItem.STKCODE;
                txtAppendix1.Text = oItem.APPENDIX1;
                txtAppendix2.Text = oItem.APPENDIX2;
                txtAppendix3.Text = oItem.APPENDIX3;

                cboClass1.Text = oItem.CLASS1;
                cboClass2.Text = oItem.CLASS2;
                cboClass3.Text = oItem.CLASS3;
                cboClass4.Text = oItem.CLASS4;
                cboClass5.Text = oItem.CLASS5;
                cboClass6.Text = oItem.CLASS6;

                txtProductName.Text    = oItem.ProductName;
                txtProductNameChs.Text = oItem.ProductName_Chs;
                txtProductNameCht.Text = oItem.ProductName_Cht;
                txtRemarks.Text        = oItem.Remarks;

                txtRetailDiscount.Text  = oItem.NormalDiscount.ToString("n2");
                txtUnit.Text            = oItem.UOM;
                cboNature.SelectedValue = oItem.NatureId;

                // 2013.12.24 paulus: dbo.Prodct 也有對應的 fields
                txtWholesalesPrice.Text     = oItem.WholesalePrice.ToString("n2");
                txtOriginalRetailPrice.Text = oItem.OriginalRetailPrice.ToString("n2");
                txtCurrentRetailPrice.Text  = oItem.RetailPrice.ToString("n2");

                // Order Info
                txtVendorItemNum.Text   = oItem.AlternateItem; // Vendor Item Number
                txtReorderLevel.Text    = oItem.ReorderLevel.ToString("n2");
                txtReorderQuantity.Text = oItem.ReorderQty.ToString("n0");

                //tabDiscountInfo
                if (oItem.FixedPriceItem)
                {
                    cboFixedPriceItem.SelectedIndex = 1;
                }
                else
                {
                    cboFixedPriceItem.SelectedIndex = 0;
                }
            }
        }
        private void CreateProducts(DataGridViewRow listItem)
        {
            string a1 = listItem.Cells[1].Value.ToString();
            string a2 = listItem.Cells[2].Value.ToString();
            string a3 = listItem.Cells[3].Value.ToString();

            System.Guid a1Id = (DAL.Common.Utility.IsGUID(listItem.Cells[4].Value.ToString())) ? new Guid(listItem.Cells[4].Value.ToString()) : System.Guid.Empty;
            System.Guid a2Id = (DAL.Common.Utility.IsGUID(listItem.Cells[5].Value.ToString())) ? new Guid(listItem.Cells[5].Value.ToString()) : System.Guid.Empty;
            System.Guid a3Id = (DAL.Common.Utility.IsGUID(listItem.Cells[6].Value.ToString())) ? new Guid(listItem.Cells[6].Value.ToString()) : System.Guid.Empty;

            string prodCode = txtStkCode.Text.Trim() + a1 + a2 + a3;

            if (prodCode.Length <= 22)
            {
                StringBuilder sql = new StringBuilder();
                sql.Append(" STKCODE = '").Append(txtStkCode.Text.Trim()).Append("' ");
                sql.Append(" AND APPENDIX1 = '").Append(a1.Trim()).Append("' ");
                sql.Append(" AND APPENDIX2 = '").Append(a2.Trim()).Append("' ");
                sql.Append(" AND APPENDIX3 = '").Append(a3.Trim()).Append("' ");

                RT2008.DAL.Product oItem = RT2008.DAL.Product.LoadWhere(sql.ToString());
                if (oItem == null)
                {
                    oItem = new RT2008.DAL.Product();

                    oItem.STKCODE   = txtStkCode.Text;
                    oItem.APPENDIX1 = a1;
                    oItem.APPENDIX2 = a2;
                    oItem.APPENDIX3 = a3;

                    oItem.Status = Convert.ToInt32(DAL.Common.Enums.Status.Active.ToString("d"));

                    oItem.CLASS1 = cboClass1.Text;
                    oItem.CLASS2 = cboClass2.Text;
                    oItem.CLASS3 = cboClass3.Text;
                    oItem.CLASS4 = cboClass4.Text;
                    oItem.CLASS5 = cboClass5.Text;
                    oItem.CLASS6 = cboClass6.Text;

                    oItem.ProductName     = txtProductName.Text;
                    oItem.ProductName_Chs = txtProductNameChs.Text;
                    oItem.ProductName_Cht = txtProductNameCht.Text;
                    oItem.Remarks         = txtRemarks.Text;

                    oItem.NormalDiscount = Convert.ToDecimal((txtRetailDiscount.Text == string.Empty) ? "0" : txtRetailDiscount.Text);
                    oItem.UOM            = txtUnit.Text;
                    oItem.NatureId       = new Guid(cboNature.SelectedValue.ToString());

                    oItem.FixedPriceItem = chkFixedPrice.Checked;

                    // Price
                    oItem.RetailPrice         = Convert.ToDecimal((txtCurrentRetailPrice.Text == string.Empty) ? "0" : txtCurrentRetailPrice.Text);
                    oItem.WholesalePrice      = Convert.ToDecimal((txtWholesalesPrice.Text == string.Empty) ? "0" : txtWholesalesPrice.Text);
                    oItem.OriginalRetailPrice = Convert.ToDecimal((txtOriginalRetailPrice.Text == string.Empty) ? "0" : txtOriginalRetailPrice.Text);
                    //oItem.Markup = Convert.ToDecimal((general.txtVendorPrice.Text == string.Empty) ? "0" : general.txtVendorPrice.Text);

                    // Download Packets
                    oItem.DownloadToPOS     = chkRetailItem.Checked;
                    oItem.DownloadToCounter = chkCounterItem.Checked;

                    oItem.CreatedBy  = DAL.Common.Config.CurrentUserId;
                    oItem.CreatedOn  = DateTime.Now;
                    oItem.ModifiedBy = DAL.Common.Config.CurrentUserId;
                    oItem.ModifiedOn = DateTime.Now;

                    oItem.Save();

                    this.ProductId = oItem.ProductId;

                    SaveProductBarcode(oItem.ProductId, prodCode);

                    // Appendix / Class
                    System.Guid c1Id = (cboClass1.SelectedValue != null) ? new Guid(cboClass1.SelectedValue.ToString()) : System.Guid.Empty;
                    System.Guid c2Id = (cboClass2.SelectedValue != null) ? new Guid(cboClass2.SelectedValue.ToString()) : System.Guid.Empty;
                    System.Guid c3Id = (cboClass3.SelectedValue != null) ? new Guid(cboClass3.SelectedValue.ToString()) : System.Guid.Empty;
                    System.Guid c4Id = (cboClass4.SelectedValue != null) ? new Guid(cboClass4.SelectedValue.ToString()) : System.Guid.Empty;
                    System.Guid c5Id = (cboClass5.SelectedValue != null) ? new Guid(cboClass5.SelectedValue.ToString()) : System.Guid.Empty;
                    System.Guid c6Id = (cboClass6.SelectedValue != null) ? new Guid(cboClass6.SelectedValue.ToString()) : System.Guid.Empty;
                    SaveProductCode(oItem.ProductId, a1Id, a2Id, a3Id, c1Id, c2Id, c3Id, c4Id, c5Id, c6Id);

                    // Product Price
                    SaveProductSupplement(oItem.ProductId);
                    SaveProductPrice(oItem.ProductId);

                    // Remarks
                    SaveProductRemarks(oItem.ProductId);

                    SaveCurrentSummary(oItem.ProductId);
                }
            }
        }