Exemplo n.º 1
0
        public static ProductDetails setSyncProductDetails(XmlReader xmlReader)
        {
            ProductDetails clsProductDetails = new ProductDetails();
            
            clsProductDetails.ProductID = Int64.Parse(xmlReader.GetAttribute("ProductID").ToString());
            clsProductDetails.ProductCode = xmlReader.GetAttribute("ProductCode").ToString();
            clsProductDetails.ProductDesc = xmlReader.GetAttribute("ProductDesc").ToString();
            clsProductDetails.ProductSubGroupID = Int64.Parse(xmlReader.GetAttribute("ProductSubGroupID").ToString());
            clsProductDetails.BaseUnitID = Int32.Parse(xmlReader.GetAttribute("BaseUnitID").ToString());
            clsProductDetails.DateCreated = DateTime.TryParse(xmlReader.GetAttribute("DateCreated").ToString(), out clsProductDetails.DateCreated) ? clsProductDetails.DateCreated : DateTime.Now;
            clsProductDetails.Deleted = bool.Parse(xmlReader.GetAttribute("Deleted").ToString());
            clsProductDetails.IncludeInSubtotalDiscount = bool.Parse(xmlReader.GetAttribute("IncludeInSubtotalDiscount").ToString());
            clsProductDetails.WillPrintProductComposition = bool.Parse(xmlReader.GetAttribute("WillPrintProductComposition").ToString());
            clsProductDetails.Active = bool.Parse(xmlReader.GetAttribute("Active").ToString());
            clsProductDetails.PercentageCommision = decimal.Parse(xmlReader.GetAttribute("PercentageCommision").ToString());
            clsProductDetails.RID = Int64.Parse(xmlReader.GetAttribute("RID").ToString());
            clsProductDetails.RewardPoints = decimal.Parse(xmlReader.GetAttribute("RewardPoints").ToString());
            clsProductDetails.SequenceNo = Int64.Parse(xmlReader.GetAttribute("SequenceNo").ToString());
            clsProductDetails.IsCreditChargeExcluded = bool.Parse(xmlReader.GetAttribute("IsCreditChargeExcluded").ToString());
            clsProductDetails.LastModified = DateTime.TryParse(xmlReader.GetAttribute("LastModified").ToString(), out clsProductDetails.LastModified) ? clsProductDetails.LastModified : DateTime.Now;

            clsProductDetails.MinThreshold = decimal.Parse(xmlReader.GetAttribute("MinThreshold").ToString());
            clsProductDetails.MaxThreshold = decimal.Parse(xmlReader.GetAttribute("MaxThreshold").ToString());
            clsProductDetails.SupplierID = Constants.C_RETAILPLUS_SUPPLIERID;       // 20Aug2015 : This is only for insert, do not overwrite during update sync

            return clsProductDetails;
        }
Exemplo n.º 2
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			const string defaultHeading = "Master Files";
			string stHeading = defaultHeading;
            
			const string defaultTitle = "Product Variation Combinations";
			SiteTitle.Title = defaultTitle;

			const SearchCategoryID defaultSearchIndex = SearchCategoryID.ProductVariationsMatrix;
			SearchCategoryID SearchIndex = defaultSearchIndex;			

			HorizontalNavBar.PageNavigatorid = HorizontalNavID.MasterFiles;
			
			if (Request.QueryString["task"]!=null)
			{
                Products clsProduct = new Products();
                ProductDetails clsDetails = new ProductDetails();

                long prodid = Convert.ToInt64(Common.Decrypt(Request.QueryString["prodid"].ToString(), Session.SessionID));
                clsDetails = clsProduct.Details(prodid);

                clsProduct.CommitAndDispose();

                string productCode = " for : " + clsDetails.ProductCode;

				string task = Common.Decrypt(Request.QueryString["task"].ToString(),Session.SessionID);
				switch(task)
				{
					case "add":
						stHeading = "Create New Product Variation Combination";	
						SearchIndex = SearchCategoryID.ProductVariationsMatrix;
						ctrlInsert.Visible = true;
						break;
					case "edit":
						stHeading = "Modify Product Variation Combination";
						SearchIndex = SearchCategoryID.ProductVariationsMatrix;
						ctrlUpdate.Visible = true;
						break;  
					case "det":
						stHeading = "Product Variation Details";	
						SearchIndex = SearchCategoryID.ProductVariationsMatrix;
						ctrlDetails.Visible = true;
						break;
					case "list":
						stHeading = "Product Variation Combinations List ";		
						SearchIndex = SearchCategoryID.ProductVariationsMatrix;
						ctrlList.Visible = true;
						break;		
					default:	
						break;
				}

				LargeHeading.Text = stHeading + productCode;
				RightBodySectionSearch.SearchIDSelectedItem = SearchIndex;
			}
		}
Exemplo n.º 3
0
        protected void cmdProductCode_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            DataClass clsDataClass = new DataClass();

            Data.Products clsProduct = new Data.Products();
            cboProductCode.DataTextField = "ProductCode";
            cboProductCode.DataValueField = "ProductID";

            ProductDetails clsSearchKeys = new ProductDetails();
            clsSearchKeys.ProductCode = txtProductCode.Text;

            cboProductCode.DataSource = clsProduct.ListAsDataTable(clsSearchKeys: clsSearchKeys, limit: 100).DefaultView;
            cboProductCode.DataBind();
            clsProduct.CommitAndDispose();

            if (cboProductCode.Items.Count == 0)
                cboProductCode.Items.Add(new ListItem("No product", "0"));

            cboProductCode.SelectedIndex = 0;

            cboProductCode_SelectedIndexChanged(null, null);
        }
Exemplo n.º 4
0
		private Int64 SaveRecord()
		{
			ProductDetails clsDetails = new ProductDetails();

			clsDetails.ProductCode  = txtProductCode.Text;
			clsDetails.BarCode  = txtBarcode.Text;
            clsDetails.BarCode2 = txtBarcode2.Text;
            clsDetails.BarCode3 = txtBarcode3.Text;
			clsDetails.ProductDesc = txtProductDesc.Text;
			clsDetails.ProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); 
			clsDetails.ProductSubGroupID  = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value);
			clsDetails.BaseUnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value); 
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
            clsDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text); 
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
            clsDetails.PercentageCommision = Convert.ToDecimal(txtPercentageCommision.Text);
            clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked; 
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); 
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); 
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); 
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.MinThreshold = Convert.ToDecimal(txtMinThreshold.Text);
			clsDetails.MaxThreshold = Convert.ToDecimal(txtMaxThreshold.Text);
			clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value);
            clsDetails.IsItemSold = Convert.ToBoolean(chkIsItemSold.Checked);
            clsDetails.WillPrintProductComposition = Convert.ToBoolean(chkWillPrintProductComposition.Checked);
            
			Products clsProduct = new Products();
			Int64 id = clsProduct.Insert(clsDetails);
			clsDetails.ProductID = id;

            long lngUID = long.Parse(Session["UID"].ToString());
            InvAdjustmentDetails clsInvAdjustmentDetails = new InvAdjustmentDetails();
            clsInvAdjustmentDetails.UID = lngUID;
            clsInvAdjustmentDetails.InvAdjustmentDate = DateTime.Now;
            clsInvAdjustmentDetails.ProductID = id;
            clsInvAdjustmentDetails.ProductCode = clsDetails.ProductCode;
            clsInvAdjustmentDetails.Description = clsDetails.ProductDesc;
            clsInvAdjustmentDetails.VariationMatrixID = 0;
            clsInvAdjustmentDetails.MatrixDescription = null;
            clsInvAdjustmentDetails.UnitID = clsDetails.BaseUnitID;
            clsInvAdjustmentDetails.UnitCode = cboProductUnit.SelectedItem.Text;
            clsInvAdjustmentDetails.QuantityBefore = 0;
            clsInvAdjustmentDetails.QuantityNow = clsDetails.Quantity;
            clsInvAdjustmentDetails.MinThresholdBefore = 0;
            clsInvAdjustmentDetails.MinThresholdNow = clsDetails.MinThreshold;
            clsInvAdjustmentDetails.MaxThresholdBefore = 0;
            clsInvAdjustmentDetails.MaxThresholdNow = clsDetails.MaxThreshold;
            clsInvAdjustmentDetails.Remarks = "newly added. beginning balance.";

            InvAdjustment clsInvAdjustment = new InvAdjustment(clsProduct.Connection, clsProduct.Transaction);
            clsInvAdjustment.Insert(clsInvAdjustmentDetails);

			if (chkVariations.Checked == true)
			{
				clsProduct.InheritSubGroupVariations(clsDetails.ProductSubGroupID, clsDetails.ProductID);
			}

			if (chkVariationsMatrix.Checked == true)
			{
				if (chkVariations.Checked == false)
				{
					clsProduct.InheritSubGroupVariations(clsDetails.ProductSubGroupID, clsDetails.ProductID);
				}
				clsProduct.InheritSubGroupVariationsMatrix(clsDetails.ProductSubGroupID, clsDetails.ProductID, clsDetails);
			}
			if (chkUnitMatrix.Checked == true)
			{
				clsProduct.InheritSubGroupUnitMatrix(clsDetails.ProductSubGroupID, clsDetails.ProductID);
			}

            // Aug 26, 2011 : Lemu
            // Update Required Inventory Days (RID)
            clsDetails.RID = Convert.ToInt64(txtRID.Text);
            clsProduct.UpdateRID(clsDetails.ProductID, clsDetails.RID);

			clsProduct.CommitAndDispose();

			return 0;
		}
Exemplo n.º 5
0
		private void SaveRecord()
		{
			ProductDetails clsDetails = new ProductDetails();

			clsDetails.ProductID = Convert.ToInt64(lblProductID.Text);
			clsDetails.ProductCode  = txtProductCode.Text;
			clsDetails.BarCode  = txtBarcode.Text;
            clsDetails.BarCode2 = txtBarcode2.Text;
            clsDetails.BarCode3 = txtBarcode3.Text;
			clsDetails.ProductDesc = txtProductDesc.Text;
			clsDetails.ProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); 
			clsDetails.ProductSubGroupID  = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value);
			clsDetails.BaseUnitID  = Convert.ToInt32(cboProductUnit.SelectedItem.Value); 
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
            clsDetails.Price1 = Convert.ToDecimal(txtPrice1.Text);
            clsDetails.Price2 = Convert.ToDecimal(txtPrice2.Text);
            clsDetails.Price3 = Convert.ToDecimal(txtPrice3.Text);
            clsDetails.Price4 = Convert.ToDecimal(txtPrice4.Text);
            clsDetails.Price5 = Convert.ToDecimal(txtPrice5.Text);
            clsDetails.WSPrice = Convert.ToDecimal(txtWSPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
            clsDetails.PercentageCommision = Convert.ToDecimal(txtPercentageCommision.Text);
			clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked;
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);
			clsDetails.MinThreshold = Convert.ToDecimal(txtMinThreshold.Text);
			clsDetails.MaxThreshold = Convert.ToDecimal(txtMaxThreshold.Text);
			clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value);
            clsDetails.IsItemSold = Convert.ToBoolean(chkIsItemSold.Checked);
            clsDetails.WillPrintProductComposition = Convert.ToBoolean(chkWillPrintProductComposition.Checked);
            clsDetails.UpdatedBy = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.UpdatedOn = DateTime.Now;
            clsDetails.RID = Convert.ToInt64(txtRID.Text);
            clsDetails.SequenceNo = Convert.ToInt64(txtSequenceNo.Text);

			Products clsProduct = new Products();
			clsProduct.Update(clsDetails);

            // Aug 26, 2011 : Lemu 
            // Update Requried Inventory Days (RID)
            clsProduct.UpdateRID(clsDetails.ProductID, clsDetails.RID);

			clsProduct.CommitAndDispose();
		}
Exemplo n.º 6
0
        private void AddItemToInventory(long pvtDebitMemoID)
        {
            DebitMemoDetails clsDebitMemoDetails = Details(pvtDebitMemoID);
            ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction);
            ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details();

            DebitMemoItems clsDebitMemoItems = new DebitMemoItems(base.Connection, base.Transaction);
            ProductUnit clsProductUnit = new ProductUnit(base.Connection, base.Transaction);

            ProductDetails clsProductDetails = new ProductDetails();
            Products clsProduct = new Products(base.Connection, base.Transaction);
            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);
            ProductPackage clsProductPackage = new ProductPackage(base.Connection, base.Transaction);
            MatrixPackage clsMatrixPackage = new MatrixPackage(base.Connection, base.Transaction);

            Inventory clsInventory = new Inventory(base.Connection, base.Transaction);

            ProductPackagePriceHistoryDetails clsProductPackagePriceHistoryDetails;
            ProductPackagePriceHistory clsProductPackagePriceHistory = new ProductPackagePriceHistory(base.Connection, base.Transaction);

            System.Data.DataTable dt = clsDebitMemoItems.ListAsDataTable(pvtDebitMemoID, SortField: "DebitMemoItemID", SortOrder: SortOption.Ascending);

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                long lngProductID = Convert.ToInt64(dr["ProductID"]);
                int intProductUnitID = Convert.ToInt16(dr["ProductUnitID"]);

                decimal decItemQuantity = Convert.ToDecimal(dr["Quantity"]);
                decimal decQuantity = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity);

                long lngVariationMatrixID = Convert.ToInt64(dr["VariationMatrixID"]);
                string strMatrixDescription = dr["MatrixDescription"].ToString();
                string strProductCode = dr["ProductCode"].ToString();
                string strProductUnitCode = dr["ProductUnitCode"].ToString();
                decimal decNewUnitCost = Convert.ToDecimal(dr["UnitCost"]);
                decimal decAmount = Convert.ToDecimal(dr["Amount"]);
                //decimal decSellingPrice = Convert.ToDecimal(dr["SellingPrice"]);
                decimal decVAT = Convert.ToDecimal(dr["VAT"]);
                //decimal decEVAT = Convert.ToDecimal(dr["EVAT"]);
                //decimal decLocalTax = Convert.ToDecimal(dr["LocalTax"]); 

                clsProductDetails = clsProduct.Details1(clsDebitMemoDetails.BranchID, lngProductID);
                /*******************************************
				 * Add in the Purchase Price History based on Debit Memo
				 * ****************************************/
                // Update ProductPackagePriceHistory first to get the history
                clsProductPackagePriceHistoryDetails = new ProductPackagePriceHistoryDetails();
                clsProductPackagePriceHistoryDetails.UID = clsDebitMemoDetails.PurchaserID;
                clsProductPackagePriceHistoryDetails.PackageID = clsProductPackage.GetPackageID(lngProductID, intProductUnitID);
                clsProductPackagePriceHistoryDetails.ChangeDate = DateTime.Now;
                clsProductPackagePriceHistoryDetails.PurchasePrice = decNewUnitCost * (decItemQuantity / decQuantity);
                clsProductPackagePriceHistoryDetails.Price = -1;
                clsProductPackagePriceHistoryDetails.VAT = -1;
                clsProductPackagePriceHistoryDetails.EVAT = -1;
                clsProductPackagePriceHistoryDetails.LocalTax = -1;
                clsProductPackagePriceHistoryDetails.Remarks = "Based on DebitMemo #: " + clsDebitMemoDetails.MemoNo;
                clsProductPackagePriceHistory.Insert(clsProductPackagePriceHistoryDetails);

                /*******************************************
                 * Subtract from Inventory : Remove this since this is a Debit Memo
                 * ****************************************/
                //clsProduct.SubtractQuantity(lngProductID, decQuantity);
                //if (lngVariationMatrixID != 0)
                //{
                //    clsProductVariationsMatrix.SubtractQuantity(lngVariationMatrixID, decQuantity);
                //}

                /*******************************************
				 * Update Purchasing Information
				 * ****************************************/
                int iBaseUnitID = clsProduct.get_BaseUnitID(lngProductID);
                if (iBaseUnitID != intProductUnitID)
                {
                    clsProduct.UpdatePurchasing(lngProductID, lngVariationMatrixID, clsDebitMemoDetails.SupplierID, iBaseUnitID, (decItemQuantity * decNewUnitCost) / decQuantity);
                }
                clsProduct.UpdatePurchasing(lngProductID, lngVariationMatrixID, clsDebitMemoDetails.SupplierID, intProductUnitID, decNewUnitCost);

                /*******************************************
                 * Add to Inventory Analysis
                 * ****************************************/
                InventoryDetails clsInventoryDetails = new InventoryDetails();
                clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom;
                clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo;
                clsInventoryDetails.PostingDate = clsDebitMemoDetails.PostingDate;
                clsInventoryDetails.ReferenceNo = clsDebitMemoDetails.MemoNo;
                clsInventoryDetails.ContactID = clsDebitMemoDetails.SupplierID;
                clsInventoryDetails.ContactCode = clsDebitMemoDetails.SupplierCode;
                clsInventoryDetails.ProductID = lngProductID;
                clsInventoryDetails.ProductCode = strProductCode;
                clsInventoryDetails.VariationMatrixID = lngVariationMatrixID;
                clsInventoryDetails.MatrixDescription = strMatrixDescription;
                clsInventoryDetails.PDebitQuantity = decQuantity;
                clsInventoryDetails.PDebitCost = decAmount - decVAT;
                clsInventoryDetails.PDebitVAT = decAmount;

                clsInventory.Insert(clsInventoryDetails);

            }
        }
Exemplo n.º 7
0
        protected void imgProductQuickAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtProductCode.Text))
                {
                    ProductDetails clsDetails = new ProductDetails();

                    clsDetails.ProductCode = txtProductCode.Text;
                    clsDetails.BarCode = txtProductCode.Text;
                    clsDetails.ProductDesc = txtProductCode.Text;
                    clsDetails.ProductGroupID = ProductGroup.DEFAULT_GROUP_ID;
                    clsDetails.ProductSubGroupID = ProductSubGroup.DEFAULT_SUB_GROUP_ID;
                    clsDetails.BaseUnitID = Data.Unit.DEFAULT_UNIT_ID;
                    clsDetails.Price = 0;
                    clsDetails.PurchasePrice = 0;
                    clsDetails.IncludeInSubtotalDiscount = true;
                    clsDetails.VAT = Constants.DEFAULTS_VAT;
                    clsDetails.EVAT = 0;
                    clsDetails.LocalTax = 0;
                    clsDetails.Quantity = 0;
                    clsDetails.MinThreshold = 0;
                    clsDetails.MaxThreshold = 0;
                    clsDetails.SupplierID = Contacts.DEFAULT_SUPPLIER_ID;
                    clsDetails.IsItemSold = true;
                    clsDetails.WillPrintProductComposition = false;

                    Products clsProduct = new Products();
                    long id = clsProduct.Insert(clsDetails);
                    clsDetails.ProductID = id;

                    long lngUID = long.Parse(Session["UID"].ToString());
                    InvAdjustmentDetails clsInvAdjustmentDetails = new InvAdjustmentDetails();
                    clsInvAdjustmentDetails.UID = lngUID;
                    clsInvAdjustmentDetails.InvAdjustmentDate = DateTime.Now;
                    clsInvAdjustmentDetails.ProductID = id;
                    clsInvAdjustmentDetails.ProductCode = clsDetails.ProductCode;
                    clsInvAdjustmentDetails.Description = clsDetails.ProductDesc;
                    clsInvAdjustmentDetails.VariationMatrixID = 0;
                    clsInvAdjustmentDetails.MatrixDescription = null;
                    clsInvAdjustmentDetails.UnitID = clsDetails.BaseUnitID;
                    clsInvAdjustmentDetails.UnitCode = cboProductUnit.SelectedItem.Text;
                    clsInvAdjustmentDetails.QuantityBefore = 0;
                    clsInvAdjustmentDetails.QuantityNow = clsDetails.Quantity;
                    clsInvAdjustmentDetails.MinThresholdBefore = 0;
                    clsInvAdjustmentDetails.MinThresholdNow = clsDetails.MinThreshold;
                    clsInvAdjustmentDetails.MaxThresholdBefore = 0;
                    clsInvAdjustmentDetails.MaxThresholdNow = clsDetails.MaxThreshold;
                    clsInvAdjustmentDetails.Remarks = "newly added. beginning balance.";

                    InvAdjustment clsInvAdjustment = new InvAdjustment(clsProduct.Connection, clsProduct.Transaction);
                    clsInvAdjustment.Insert(clsInvAdjustmentDetails);

                    clsProduct.InheritSubGroupVariations(clsDetails.ProductSubGroupID, clsDetails.ProductID);

                    clsProduct.CommitAndDispose();

                    cmdProductCode_Click(null, null);
                }
            }
            catch { }
        }
Exemplo n.º 8
0
        private void ExportToFile()
        {

            DataClass clsDataClass = new DataClass();

            PO clsPO = new PO();
            PODetails clsPODetails = clsPO.Details(long.Parse(lblPOID.Text));

            POItem clsPOItem = new POItem(clsPO.Connection, clsPO.Transaction);
            DataTable dtaPOItems = clsPOItem.ListAsDataTable(clsPODetails.POID, null, SortOption.Ascending);

            Branch clsBranch = new Branch(clsPO.Connection, clsPO.Transaction);
            BranchDetails clsBranchDetails;

            Contacts clsContact = new Contacts(clsPO.Connection, clsPO.Transaction);
            ContactDetails clsContactDetails;

            Products clsProduct = new Products(clsPO.Connection, clsPO.Transaction);
            ProductDetails clsProductDetails;

            ProductVariations clsProductVariation = new ProductVariations(clsPO.Connection, clsPO.Transaction);
            DataTable dtaProductVariation;

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsPO.Connection, clsPO.Transaction);
            DataTable dtaProductVariationsMatrix;

            string xmlFileName = Server.MapPath(@"\RetailPlus\temp\" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsPODetails.PONo + "_" + clsPODetails.PODate.ToString("yyyyMMddHHmmssffff") + ".xml");
            XmlTextWriter writer = new XmlTextWriter(xmlFileName, System.Text.Encoding.UTF8);

            writer.Formatting = Formatting.Indented;
            writer.WriteStartDocument();
            writer.WriteComment("This file represents the Purchase Order Details of PO No: '" + clsPODetails.PONo + "' for " + lblBranchCode.Text + " branch.");
            writer.WriteComment("Save this in your local file. Goto 'File', click 'Save As', select the location in your local directory, click 'Save'.");
            writer.WriteStartElement("PODetails");
            writer.WriteAttributeString("POID", XmlConvert.ToString(clsPODetails.POID));
            writer.WriteAttributeString("PONo", clsPODetails.PONo);
            writer.WriteAttributeString("PODate", clsPODetails.PODate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Supplier information******/
            clsContactDetails = clsContact.Details(clsPODetails.SupplierID);
            writer.WriteAttributeString("SupplierID", XmlConvert.ToString(clsContactDetails.ContactID));
            writer.WriteAttributeString("SupplierCode", clsContactDetails.ContactCode);
            writer.WriteAttributeString("SupplierName", clsContactDetails.ContactName);
            writer.WriteAttributeString("SupplierContact", clsContactDetails.BusinessName);
            writer.WriteAttributeString("SupplierAddress", clsPODetails.SupplierAddress);
            writer.WriteAttributeString("SupplierTelephoneNo", clsPODetails.SupplierTelephoneNo);
            writer.WriteAttributeString("SupplierModeOfTerms", XmlConvert.ToString(clsPODetails.SupplierModeOfTerms));
            writer.WriteAttributeString("SupplierTerms", XmlConvert.ToString(clsPODetails.SupplierTerms));
            writer.WriteAttributeString("SupplierContactGroupName", clsContactDetails.ContactGroupName);
            /******End Of Supplier Information******/

            writer.WriteAttributeString("RequiredDeliveryDate", clsPODetails.RequiredDeliveryDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Branch & Purchaser Information******/
            clsBranchDetails = clsBranch.Details(short.Parse(clsPODetails.BranchID.ToString()));
            writer.WriteAttributeString("BranchID", XmlConvert.ToString(clsPODetails.BranchID));
            writer.WriteAttributeString("BranchCode", clsPODetails.BranchCode);
            writer.WriteAttributeString("BranchName", clsPODetails.BranchName);
            writer.WriteAttributeString("BranchAddress", clsPODetails.BranchAddress);
            writer.WriteAttributeString("BranchDBIP", clsBranchDetails.DBIP);
            writer.WriteAttributeString("BranchDBPort", clsBranchDetails.DBPort);
            writer.WriteAttributeString("BranchRemarks", clsBranchDetails.Remarks);
            writer.WriteAttributeString("PurchaserID", clsPODetails.PurchaserID.ToString());
            writer.WriteAttributeString("PurchaserName", clsPODetails.PurchaserName);
            /******End Of Branch & Purchaser Information******/

            /******Amount Information******/
            writer.WriteAttributeString("SubTotal", XmlConvert.ToString(clsPODetails.SubTotal));
            writer.WriteAttributeString("Discount", XmlConvert.ToString(clsPODetails.Discount));
            writer.WriteAttributeString("DiscountApplied", XmlConvert.ToString(clsPODetails.DiscountApplied));
            writer.WriteAttributeString("DiscountType", clsPODetails.DiscountType.ToString("d"));
            writer.WriteAttributeString("VAT", XmlConvert.ToString(clsPODetails.VAT));
            writer.WriteAttributeString("VatableAmount", XmlConvert.ToString(clsPODetails.VatableAmount));
            writer.WriteAttributeString("EVAT", XmlConvert.ToString(clsPODetails.EVAT));
            writer.WriteAttributeString("EVatableAmount", XmlConvert.ToString(clsPODetails.EVatableAmount));
            writer.WriteAttributeString("LocalTax", XmlConvert.ToString(clsPODetails.LocalTax));
            writer.WriteAttributeString("Freight", XmlConvert.ToString(clsPODetails.Freight));
            writer.WriteAttributeString("Deposit", XmlConvert.ToString(clsPODetails.Deposit));
            writer.WriteAttributeString("UnpaidAmount", XmlConvert.ToString(clsPODetails.UnpaidAmount));
            writer.WriteAttributeString("PaidAmount", XmlConvert.ToString(clsPODetails.PaidAmount));
            writer.WriteAttributeString("TotalItemDiscount", XmlConvert.ToString(clsPODetails.TotalItemDiscount));
            writer.WriteAttributeString("Status", clsPODetails.Status.ToString("d"));
            writer.WriteAttributeString("Remarks", clsPODetails.Remarks);
            writer.WriteAttributeString("SupplierDRNo", clsPODetails.SupplierDRNo);
            writer.WriteAttributeString("DeliveryDate", clsPODetails.DeliveryDate.ToString("MM/dd/yyyy HH:mm:ss"));
            writer.WriteAttributeString("CancelledDate", clsPODetails.CancelledDate.ToString("MM/dd/yyyy HH:mm:ss"));
            writer.WriteAttributeString("CancelledRemarks", clsPODetails.CancelledRemarks);
            writer.WriteAttributeString("CancelledByID", XmlConvert.ToString(clsPODetails.CancelledByID));
            /******End Of Branch Information******/

            foreach (DataRow row in dtaPOItems.Rows)
            {
                clsProductDetails = new ProductDetails();
                clsProductDetails = clsProduct.Details(Convert.ToInt64(row["ProductID"].ToString()));

                writer.WriteStartElement("POItem");
                writer.WriteAttributeString("POItemID", row["POItemID"].ToString());
                writer.WriteAttributeString("POID", row["POID"].ToString());
                writer.WriteAttributeString("ProductID", row["ProductID"].ToString());

                /*****Product Information*****/
                writer.WriteAttributeString("ProductCode", clsProductDetails.ProductCode);
                writer.WriteAttributeString("BarCode", clsProductDetails.BarCode);
                writer.WriteAttributeString("ProductDesc", clsProductDetails.ProductDesc);
                writer.WriteAttributeString("MatrixDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ProductSubGroupID", clsProductDetails.ProductSubGroupID.ToString());
                writer.WriteAttributeString("ProductSubGroupCode", clsProductDetails.ProductSubGroupCode);
                writer.WriteAttributeString("ProductSubGroupName", clsProductDetails.ProductSubGroupName);
                writer.WriteAttributeString("ProductGroupID", clsProductDetails.ProductGroupID.ToString());
                writer.WriteAttributeString("ProductGroupCode", clsProductDetails.ProductGroupCode);
                writer.WriteAttributeString("ProductGroupName", clsProductDetails.ProductGroupName);
                writer.WriteAttributeString("BaseUnitID", clsProductDetails.BaseUnitID.ToString());
                writer.WriteAttributeString("BaseUnitCode", clsProductDetails.BaseUnitCode);
                writer.WriteAttributeString("BaseUnitName", clsProductDetails.BaseUnitName);
                writer.WriteAttributeString("DateCreated", clsProductDetails.DateCreated.ToString("MM/dd/yy HH:mm:ss"));
                writer.WriteAttributeString("Deleted", clsProductDetails.Deleted.ToString());
                writer.WriteAttributeString("Price", clsProductDetails.Price.ToString());
                writer.WriteAttributeString("PurchasePrice", clsProductDetails.PurchasePrice.ToString());
                writer.WriteAttributeString("IncludeInSubtotalDiscount", clsProductDetails.IncludeInSubtotalDiscount.ToString());
                writer.WriteAttributeString("VAT", clsProductDetails.VAT.ToString());
                writer.WriteAttributeString("EVAT", clsProductDetails.EVAT.ToString());
                writer.WriteAttributeString("LocalTax", clsProductDetails.LocalTax.ToString());
                writer.WriteAttributeString("Quantity", clsProductDetails.Quantity.ToString());
                writer.WriteAttributeString("MinThreshold", clsProductDetails.MinThreshold.ToString());
                writer.WriteAttributeString("MaxThreshold", clsProductDetails.MaxThreshold.ToString());
                writer.WriteAttributeString("ChartOfAccountIDPurchase", clsProductDetails.ChartOfAccountIDPurchase.ToString());
                writer.WriteAttributeString("ChartOfAccountIDSold", clsProductDetails.ChartOfAccountIDSold.ToString());
                writer.WriteAttributeString("ChartOfAccountIDInventory", clsProductDetails.ChartOfAccountIDInventory.ToString());
                writer.WriteAttributeString("ChartOfAccountIDTaxPurchase", clsProductDetails.ChartOfAccountIDTaxPurchase.ToString());
                writer.WriteAttributeString("ChartOfAccountIDTaxSold", clsProductDetails.ChartOfAccountIDTaxSold.ToString());
                writer.WriteAttributeString("IsItemSold", clsProductDetails.IsItemSold.ToString());
                writer.WriteAttributeString("WillPrintProductComposition", clsProductDetails.WillPrintProductComposition.ToString());
                writer.WriteAttributeString("UpdatedBy", clsProductDetails.UpdatedBy.ToString());
                writer.WriteAttributeString("UpdatedOn", clsProductDetails.UpdatedOn.ToString("MM/dd/yyyy HH:mm"));
                writer.WriteAttributeString("PercentageCommision", clsProductDetails.PercentageCommision.ToString());
                writer.WriteAttributeString("Active", clsProductDetails.Active.ToString());
                /*****End Of Product Information*****/

                writer.WriteAttributeString("ItemProductGroup", row["ProductGroup"].ToString());
                writer.WriteAttributeString("ItemProductSubGroup", row["ProductSubGroup"].ToString());
                writer.WriteAttributeString("ItemVariationMatrixID", row["VariationMatrixID"].ToString());
                writer.WriteAttributeString("ItemBaseVariationDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ItemProductUnitID", row["ProductUnitID"].ToString());
                writer.WriteAttributeString("ItemProductUnitCode", row["ProductUnitCode"].ToString());
                writer.WriteAttributeString("ItemQuantity", row["Quantity"].ToString());
                writer.WriteAttributeString("ItemUnitCost", row["UnitCost"].ToString());
                writer.WriteAttributeString("ItemDiscount", row["Discount"].ToString());
                writer.WriteAttributeString("ItemDiscountApplied", row["DiscountApplied"].ToString());
                writer.WriteAttributeString("ItemDiscountType", row["DiscountType"].ToString());
                writer.WriteAttributeString("ItemAmount", row["Amount"].ToString());
                writer.WriteAttributeString("ItemVAT", row["VAT"].ToString());
                writer.WriteAttributeString("ItemVatableAmount", row["VatableAmount"].ToString());
                writer.WriteAttributeString("ItemEVAT", row["EVAT"].ToString());
                writer.WriteAttributeString("ItemEVatableAmount", row["EVatableAmount"].ToString());
                writer.WriteAttributeString("ItemLocalTax", row["LocalTax"].ToString());
                writer.WriteAttributeString("ItemisVATInclusive", row["isVATInclusive"].ToString());
                writer.WriteAttributeString("ItemPOItemStatus", row["POItemStatus"].ToString());
                writer.WriteAttributeString("ItemIsVatable", row["IsVatable"].ToString());
                writer.WriteAttributeString("ItemSellingPrice", row["SellingPrice"].ToString());
                writer.WriteAttributeString("ItemSellingVAT", row["SellingVAT"].ToString());
                writer.WriteAttributeString("ItemSellingEVAT", row["SellingEVAT"].ToString());
                writer.WriteAttributeString("ItemSellingLocalTax", row["SellingLocalTax"].ToString());
                writer.WriteAttributeString("ItemOldSellingPrice", row["OldSellingPrice"].ToString());
                writer.WriteAttributeString("ItemRemarks", row["Remarks"].ToString());

                dtaProductVariation = clsProductVariation.ListAsDataTable(clsProductDetails.ProductID, null, System.Data.SqlClient.SortOrder.Ascending);
                foreach (DataRow rowVariation in dtaProductVariation.Rows)
                {
                    writer.WriteStartElement("Variation", null);
                    writer.WriteAttributeString("VariationCode", rowVariation["VariationCode"].ToString());
                    writer.WriteAttributeString("VariationType", rowVariation["VariationType"].ToString());
                    writer.WriteEndElement();
                }

                dtaProductVariationsMatrix = clsProductVariationsMatrix.ProductVariationsMatrixListAsDataTable(long.Parse(row["VariationMatrixID"].ToString()), null, System.Data.SqlClient.SortOrder.Ascending);
                foreach (DataRow rowVariationsMatrix in dtaProductVariationsMatrix.Rows)
                {
                    writer.WriteStartElement("VariationMatrix", null);
                    writer.WriteAttributeString("MatriXID", rowVariationsMatrix["MatriXID"].ToString());
                    writer.WriteAttributeString("VariationID", rowVariationsMatrix["VariationID"].ToString());
                    writer.WriteAttributeString("Description", rowVariationsMatrix["Description"].ToString());
                    writer.WriteAttributeString("VariationCode", rowVariationsMatrix["VariationCode"].ToString());
                    writer.WriteAttributeString("VariationType", rowVariationsMatrix["VariationType"].ToString());
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }

            writer.WriteEndElement();

            //Write the XML to file and close the writer
            writer.Flush();
            writer.Close();

            clsPO.CommitAndDispose();

            string stScript = "<Script>";
            stScript += "window.open('/RetailPlus/temp/" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsPODetails.PONo + "_" + clsPODetails.PODate.ToString("yyyyMMddHHmmssffff") + ".xml')";
            stScript += "</Script>";
            Response.Write(stScript);
        }
Exemplo n.º 9
0
        //public System.Data.DataTable ListAsDataTable(ProductColumns clsProductColumns, int BranchID, ProductListFilterType clsProductListFilterType,
        //    long SequenceNoStart, System.Data.SqlClient.SortOrder SequenceSortOrder,
        //    ProductColumns SearchColumns, string SearchKey, long SupplierID, long ProductGroupID, string ProductGroupName, long ProductSubGroupID, string ProductSubGroupName, Int32 limit, bool isQuantityGreaterThanZERO, bool CheckIItemisSold, string SortField, SortOption SortOrder, string GroupBy)
        //{
        //    try
        //    {
        //        clsProductColumns.IncludeAllPackages = true;
        //        // include branchid in the selection if branchid is not zero
        //        if (BranchID != 0) clsProductColumns.BranchID = true;

        //        string SQL = SQLSelect(clsProductColumns) + "WHERE prd.deleted=0 ";

        //        if (SequenceNoStart != Constants.ZERO)
        //        {
        //            if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
        //                SQL += "AND prd.SequenceNo < " + SequenceNoStart.ToString() + " ";
        //            else
        //                SQL += "AND prd.SequenceNo > " + SequenceNoStart.ToString() + " ";
        //        }

        //        if (BranchID != Constants.ZERO) SQL += "AND inv.BranchID = " + BranchID.ToString() + " ";
        //        if (CheckIItemisSold) SQL += "AND prd.IsItemSold = 1 ";
        //        if (clsProductListFilterType == ProductListFilterType.ShowActiveOnly) SQL += "AND prd.Active = 1 ";
        //        if (clsProductListFilterType == ProductListFilterType.ShowInactiveOnly) SQL += "AND prd.Active = 0 ";

        //        if (SearchKey != string.Empty)
        //        {
        //            string SQLSearch = string.Empty;

        //            if (SearchColumns.BarCode)
        //            { if (SQLSearch == string.Empty) SQLSearch += "prd.Barcode LIKE @SearchKey "; else SQLSearch += "OR prd.Barcode LIKE @SearchKey "; }

        //            if (SearchColumns.BarCode2)
        //            { if (SQLSearch == string.Empty) SQLSearch += "prd.Barcode2 LIKE @SearchKey "; else SQLSearch += "OR prd.Barcode2 LIKE @SearchKey "; }

        //            if (SearchColumns.BarCode3)
        //            { if (SQLSearch == string.Empty) SQLSearch += "prd.Barcode3 LIKE @SearchKey "; else SQLSearch += "OR prd.Barcode3 LIKE @SearchKey "; }

        //            if (SearchColumns.ProductCode)
        //            { if (SQLSearch == string.Empty) SQLSearch += "prd.ProductCode LIKE @SearchKey "; else SQLSearch += "OR prd.ProductCode LIKE @SearchKey "; }

        //            if (SearchColumns.ProductDesc)
        //            { if (SQLSearch == string.Empty) SQLSearch += "prd.ProductDesc LIKE @SearchKey "; else SQLSearch += "OR prd.ProductDesc LIKE @SearchKey "; }

        //            if (SQLSearch != string.Empty) SQL += "AND (" + SQLSearch + ") ";
        //        }

        //        if (SupplierID != Constants.ZERO)
        //            SQL += "AND (prd.SupplierID = " + SupplierID + " OR ProductID IN (SELECT DISTINCT(ProductID) FROM tblProductBaseVariationsMatrix WHERE SupplierID = " + SupplierID + ")) ";

        //        if (ProductSubGroupID != Constants.ZERO)
        //        { SQL += "AND prd.ProductSubGroupID = " + ProductSubGroupID + " "; }

        //        if (ProductSubGroupName != string.Empty && ProductSubGroupName != null)
        //        { SQL += "AND tblProductSubGroup.ProductSubGroupName = '" + ProductSubGroupName + "' "; }

        //        if (ProductGroupID != Constants.ZERO)
        //        { SQL += "AND tblProductSubGroup.ProductGroupID = " + ProductGroupID + " "; }

        //        if (ProductGroupName != string.Empty && ProductGroupName != null)
        //        { SQL += "AND tblProductGroup.ProductGroupName = '" + ProductGroupName + "' "; }

        //        if (isQuantityGreaterThanZERO)
        //        { SQL += "AND inv.Quantity > 0 "; }

        //        if (GroupBy != string.Empty || GroupBy != null)
        //            SQL += "GROUP BY " + GroupBy + " ";

        //        if (SortField == string.Empty) SortField = "ProductCode";
        //        SQL += "ORDER BY " + SortField + " ";

        //        if (SortOrder == SortOption.Ascending)
        //            SQL += "ASC ";
        //        else
        //            SQL += "DESC ";

        //        if (limit != 0)
        //            SQL += "LIMIT " + limit + " ";

				

        //        MySqlCommand cmd = new MySqlCommand();
				
				
        //        cmd.CommandType = System.Data.CommandType.Text;
        //        cmd.CommandText = SQL;


        //        MySqlParameter prmSearchKey = new MySqlParameter("@SearchKey",MySqlDbType.String);
        //        prmSearchKey.Value = SearchKey + "%";
        //        cmd.Parameters.Add(prmSearchKey);

        //        string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
        //        base.MySqlDataAdapterFill(cmd, dt);
				

        //        return dt;
        //    }
        //    catch (Exception ex)
        //    {
				
				
        //        {
					
					
					
					
        //        }

        //        throw base.ThrowException(ex);
        //    }
        //}

        public System.Data.DataTable ListAsDataTable(ProductColumns clsProductColumns, ProductDetails clsSearchKey, 
            int BranchID = 0, ProductListFilterType clsProductListFilterType = ProductListFilterType.ShowActiveOnly,
            Int64 SequenceNoStart = 0, System.Data.SqlClient.SortOrder SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending,
            Int64 SupplierID = 0, Int64 ProductGroupID = 0, string ProductGroupName = "", 
            Int64 ProductSubGroupID = 0, string ProductSubGroupName = "",
            bool CheckisQuantityGreaterThanZERO = false, bool isQuantityGreaterThanZERO = false, 
            bool CheckItemisSold = false, bool ItemisSold = true, 
            string SortField = "", SortOption SortOrder = SortOption.Ascending, Int32 limit = 0)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect(clsProductColumns) + "WHERE prd.deleted=0 ";

                if (SequenceNoStart != Constants.ZERO)
                {
                    if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
                        SQL += "AND prd.SequenceNo < " + SequenceNoStart.ToString() + " ";
                    else
                        SQL += "AND prd.SequenceNo > " + SequenceNoStart.ToString() + " ";
                }

                if (BranchID != Constants.ZERO) SQL += "AND tblProductInventory.BranchID = " + BranchID.ToString() + " ";
                if (CheckItemisSold) SQL += "AND prd.IsItemSold = 1 ";
                if (clsProductListFilterType == ProductListFilterType.ShowActiveOnly) SQL += "AND prd.Active = 1 ";
                if (clsProductListFilterType == ProductListFilterType.ShowInactiveOnly) SQL += "AND prd.Active = 0 ";

                if (SupplierID != Constants.ZERO)
                    SQL += "AND (prd.SupplierID = " + SupplierID + " OR ProductID IN (SELECT DISTINCT(ProductID) FROM tblProductBaseVariationsMatrix WHERE SupplierID = " + SupplierID + ")) ";

                if (ProductSubGroupID != Constants.ZERO)
                { SQL += "AND prd.ProductSubGroupID = " + ProductSubGroupID + " "; }

                if (ProductSubGroupName != string.Empty && ProductSubGroupName != null)
                { SQL += "AND sgrp.ProductSubGroupName = '" + ProductSubGroupName + "' "; }

                if (ProductGroupID != Constants.ZERO)
                { SQL += "AND sgrp.ProductGroupID = " + ProductGroupID + " "; }

                if (ProductGroupName != string.Empty && ProductGroupName != null)
                { SQL += "AND grp.ProductGroupName = '" + ProductGroupName + "' "; }

                if (isQuantityGreaterThanZERO)
                { SQL += "AND tblProductInventory.Quantity > 0 "; }

                //if (GroupBy != string.Empty || GroupBy != null)
                //    SQL += "GROUP BY " + GroupBy + " ";

                if (SortField == string.Empty) SortField = "ProductCode";
                SQL += "ORDER BY " + SortField + " ";

                if (SortOrder == SortOption.Ascending)
                    SQL += "ASC ";
                else
                    SQL += "DESC ";

                if (limit != 0)
                    SQL += "LIMIT " + limit + " ";


                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                return dt;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 10
0
        public System.Data.DataTable ListAsDataTable(Int32 BranchID = 0, ProductDetails clsSearchKeys = new ProductDetails(), ProductAddOnFilters ProductAddOnFilters = new ProductAddOnFilters(), ProductListFilterType clsProductListFilterType = ProductListFilterType.ShowActiveAndInactive,
                    long SequenceNoStart = 0, System.Data.SqlClient.SortOrder SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending, Int32 limit = 0, bool isQuantityGreaterThanZERO = false, string SortField = "ProductCode", SortOption SortOrder = SortOption.Ascending)
		{
			try
			{
                System.Data.DataTable dt = ListAsDataTable(BranchID, clsSearchKeys.BarCode, clsSearchKeys.ProductCode, clsSearchKeys.SupplierID, clsProductListFilterType, 
                                                            isQuantityGreaterThanZERO, ProductAddOnFilters, limit, SortField, SortOrder);
                return dt;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Exemplo n.º 11
0
		public ProductDetails[] List(int BranchID = 0)
		{
			try
			{
				System.Collections.ArrayList items = new System.Collections.ArrayList();
				System.Data.DataTable dtProductIDs = ProductIDAsDataTable();
				foreach (System.Data.DataRow drProductID in dtProductIDs.Rows)
				{
                    items.Add(Details1(BranchID, long.Parse(drProductID["ProductID"].ToString())));
				}
				
				ProductDetails[] arrProductDetails = new ProductDetails[0];

				if (items != null)
				{
					arrProductDetails = new ProductDetails[items.Count];
					items.CopyTo(arrProductDetails);
				}

				return arrProductDetails;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Exemplo n.º 12
0
        private ProductDetails SetDetails(System.Data.DataTable dt)
        {
            try
            {
                ProductDetails Details = new ProductDetails();
                Details.ProductID = 0;

                foreach(System.Data.DataRow dr in dt.Rows)
                {
                    Details.ProductID = Int64.Parse(dr["ProductID"].ToString());
                    Details.ProductCode = "" + dr["ProductCode"].ToString();
                    Details.BarCode = "" + dr["BarCode"].ToString();
                    Details.BarCode1 = "" + dr["BarCode1"].ToString();
                    Details.BarCode2 = "" + dr["BarCode2"].ToString();
                    Details.BarCode3 = "" + dr["BarCode3"].ToString();
                    Details.ProductDesc = "" + dr["ProductDesc"].ToString();
                    Details.OrderSlipPrinter1 = bool.Parse(dr["OrderSlipPrinter1"].ToString());
                    Details.OrderSlipPrinter2 = bool.Parse(dr["OrderSlipPrinter2"].ToString());
                    Details.OrderSlipPrinter3 = bool.Parse(dr["OrderSlipPrinter3"].ToString());
                    Details.OrderSlipPrinter4 = bool.Parse(dr["OrderSlipPrinter4"].ToString());
                    Details.OrderSlipPrinter5 = bool.Parse(dr["OrderSlipPrinter5"].ToString());
                    Details.ProductGroupID = Int64.Parse(dr["ProductGroupID"].ToString());
                    Details.ProductGroupCode = "" + dr["ProductGroupCode"].ToString();
                    Details.ProductGroupName = "" + dr["ProductGroupName"].ToString();
                    Details.ProductSubGroupID = Int64.Parse(dr["ProductSubGroupID"].ToString());
                    Details.ProductSubGroupCode = dr["ProductSubGroupCode"].ToString();
                    Details.ProductSubGroupName = dr["ProductSubGroupName"].ToString();
                    Details.BaseUnitID = Int32.Parse(dr["BaseUnitID"].ToString());
                    Details.BaseUnitCode = dr["UnitCode"].ToString();
                    Details.BaseUnitName = dr["UnitName"].ToString();
                    Details.DateCreated = DateTime.Parse(dr["DateCreated"].ToString());
                    Details.Deleted = Boolean.Parse(dr["Deleted"].ToString());
                    Details.Active = Boolean.Parse(dr["Active"].ToString());
                    Details.Price = Decimal.Parse(dr["Price"].ToString());
                    Details.Price1 = Decimal.Parse(dr["Price1"].ToString());
                    Details.Price2 = Decimal.Parse(dr["Price2"].ToString());
                    Details.Price3 = Decimal.Parse(dr["Price3"].ToString());
                    Details.Price4 = Decimal.Parse(dr["Price4"].ToString());
                    Details.Price5 = Decimal.Parse(dr["Price5"].ToString());
                    Details.WSPrice = Decimal.Parse(dr["WSPrice"].ToString());
                    Details.PurchasePrice = Decimal.Parse(dr["PurchasePrice"].ToString());
                    Details.PercentageCommision = Decimal.Parse(dr["PercentageCommision"].ToString());
                    Details.IncludeInSubtotalDiscount = Boolean.Parse(dr["IncludeInSubtotalDiscount"].ToString());
                    Details.IsCreditChargeExcluded = Boolean.Parse(dr["IsCreditChargeExcluded"].ToString());
                    Details.VAT = Decimal.Parse(dr["VAT"].ToString());
                    Details.EVAT = Decimal.Parse(dr["EVAT"].ToString());
                    Details.LocalTax = Decimal.Parse(dr["LocalTax"].ToString());
                    Details.Quantity = Decimal.Parse(dr["Quantity"].ToString());
                    Details.ConvertedQuantity = dr["ConvertedQuantity"].ToString();
                    Details.ReservedQuantity = Decimal.Parse(dr["ReservedQuantity"].ToString());
                    Details.IsLock = Convert.ToBoolean(int.Parse(dr["IsLock"].ToString()));
                    Details.MinThreshold = Decimal.Parse(dr["MinThreshold"].ToString());
                    Details.MaxThreshold = Decimal.Parse(dr["MaxThreshold"].ToString());
                    Details.RID = Int64.Parse(dr["RID"].ToString());
                    Details.SequenceNo = Int64.Parse(dr["SequenceNo"].ToString());
                    Details.SupplierID = Int64.Parse(dr["SupplierID"].ToString());
                    Details.SupplierCode = dr["SupplierCode"].ToString();
                    Details.SupplierName = dr["SupplierName"].ToString();

                    /*** Added for Financial Information  ***/
                    /*** January 12, 2009 ***/
                    Details.ChartOfAccountIDPurchase = Int32.Parse(dr["ChartOfAccountIDPurchase"].ToString());
                    Details.ChartOfAccountIDSold = Int32.Parse(dr["ChartOfAccountIDSold"].ToString());
                    Details.ChartOfAccountIDInventory = Int32.Parse(dr["ChartOfAccountIDInventory"].ToString());
                    Details.ChartOfAccountIDTaxPurchase = Int32.Parse(dr["ChartOfAccountIDTaxPurchase"].ToString());
                    Details.ChartOfAccountIDTaxSold = Int32.Parse(dr["ChartOfAccountIDTaxSold"].ToString());

                    Details.IsItemSold = Boolean.Parse(dr["IsItemSold"].ToString());
                    Details.WillPrintProductComposition = Boolean.Parse(dr["WillPrintProductComposition"].ToString());

                    /*** Inventory Tracking ***/
                    /*** May 10, 2010 ***/
                    Details.QuantityIN = Decimal.Parse(dr["QuantityIN"].ToString());
                    Details.QuantityOUT = Decimal.Parse(dr["QuantityOUT"].ToString());

                    Details.ActualQuantity = Decimal.Parse(dr["ActualQuantity"].ToString());

                    Details.RewardPoints = Decimal.Parse(dr["RewardPoints"].ToString());

                    Details.MatrixID = Int64.Parse(dr["MatrixID"].ToString());
                    Details.MatrixDescription = "" + dr["MatrixDescription"].ToString();

                    Details.PackageID = Int64.Parse(dr["PackageID"].ToString());
                }

                return Details;
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 13
0
        public Int32 Save(ProductDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProduct(@ProductID, @ProductCode, @ProductDesc, @ProductSubGroupID," +
                                                "@BaseUnitID, @DateCreated, @Deleted, @IncludeInSubtotalDiscount, @IsCreditChargeExcluded, " +
                                                "@MinThreshold, @MaxThreshold, @SupplierID, @ChartOfAccountIDPurchase," +
                                                "@ChartOfAccountIDTaxPurchase, @ChartOfAccountIDSold, @ChartOfAccountIDTaxSold," +
                                                "@ChartOfAccountIDInventory, @IsItemSold, @WillPrintProductComposition," +
                                                "@VariationCount, @Active, @PercentageCommision, @RID, @RIDMinThreshold," +
                                                "@RIDMaxThreshold, @RewardPoints, @SequenceNo, @ChartOfAccountIDTransferIn," +
                                                "@ChartOfAccountIDTaxTransferIn, @ChartOfAccountIDTransferOut," +
                                                "@ChartOfAccountIDTaxTransferOut, @ChartOfAccountIDInvAdjustment," +
                                                "@ChartOfAccountIDTaxInvAdjustment, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("ProductID", Details.ProductID);
                cmd.Parameters.AddWithValue("ProductCode", Details.ProductCode);
                cmd.Parameters.AddWithValue("ProductDesc", Details.ProductDesc);
                cmd.Parameters.AddWithValue("ProductSubGroupID", Details.ProductSubGroupID);
                cmd.Parameters.AddWithValue("BaseUnitID", Details.BaseUnitID);
                cmd.Parameters.AddWithValue("DateCreated", Details.DateCreated.ToString("yyyy-MM-dd HH:mm:ss"));
                cmd.Parameters.AddWithValue("Deleted", Details.Deleted);
                cmd.Parameters.AddWithValue("IncludeInSubtotalDiscount", Details.IncludeInSubtotalDiscount);
                cmd.Parameters.AddWithValue("IsCreditChargeExcluded", Details.IsCreditChargeExcluded);
                cmd.Parameters.AddWithValue("MinThreshold", Details.MinThreshold);
                cmd.Parameters.AddWithValue("MaxThreshold", Details.MaxThreshold);
                cmd.Parameters.AddWithValue("SupplierID", Details.SupplierID);
                cmd.Parameters.AddWithValue("ChartOfAccountIDPurchase", Details.ChartOfAccountIDPurchase);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTaxPurchase", Details.ChartOfAccountIDTaxPurchase);
                cmd.Parameters.AddWithValue("ChartOfAccountIDSold", Details.ChartOfAccountIDSold);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTaxSold", Details.ChartOfAccountIDTaxSold);
                cmd.Parameters.AddWithValue("ChartOfAccountIDInventory", Details.ChartOfAccountIDInventory);
                cmd.Parameters.AddWithValue("IsItemSold", Details.IsItemSold);
                cmd.Parameters.AddWithValue("WillPrintProductComposition", Details.WillPrintProductComposition);
                cmd.Parameters.AddWithValue("VariationCount", Details.VariationCount);
                cmd.Parameters.AddWithValue("Active", Details.Active);
                cmd.Parameters.AddWithValue("PercentageCommision", Details.PercentageCommision);
                cmd.Parameters.AddWithValue("RID", Details.RID);
                cmd.Parameters.AddWithValue("RIDMinThreshold", Details.RIDMinThreshold);
                cmd.Parameters.AddWithValue("RIDMaxThreshold", Details.RIDMaxThreshold);
                cmd.Parameters.AddWithValue("RewardPoints", Details.RewardPoints);
                cmd.Parameters.AddWithValue("SequenceNo", Details.SequenceNo);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTransferIn", Details.ProductChartOfAccountDetails.ChartOfAccountIDTransferIn);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTaxTransferIn", Details.ProductChartOfAccountDetails.ChartOfAccountIDTaxTransferIn);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTransferOut", Details.ProductChartOfAccountDetails.ChartOfAccountIDTransferOut);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTaxTransferOut", Details.ProductChartOfAccountDetails.ChartOfAccountIDTaxTransferOut);
                cmd.Parameters.AddWithValue("ChartOfAccountIDInvAdjustment", Details.ProductChartOfAccountDetails.ChartOfAccountIDInvAdjustment);
                cmd.Parameters.AddWithValue("ChartOfAccountIDTaxInvAdjustment", Details.ProductChartOfAccountDetails.ChartOfAccountIDTaxInvAdjustment);

                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemplo n.º 14
0
        private void Upload1()
        {
            //string fn = System.IO.Path.GetFileName(TextBox1.Text);
            //string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;

            //System.IO.File.Copy(TextBox1.Text, SaveLocation);
            //txtPath.PostedFile.SaveAs(SaveLocation);
            XmlTextReader xmlReader = new XmlTextReader(TextBox1.Text);
            xmlReader.WhitespaceHandling = WhitespaceHandling.None;

            Branch clsBranch = new Branch();
            BranchDetails clsBranchDetails = clsBranch.Details(Convert.ToInt16(cboBranchUpload.SelectedItem.Value.ToString()));
            clsBranch.CommitAndDispose();

            RemoteBranchInventory clsBranchInventory = new RemoteBranchInventory();
            clsBranchInventory.GetConnectionToBranch(clsBranchDetails.DBIP);

            Contacts clsBranchContact = new Contacts(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            ContactDetails clsBranchContactDetails;

            ContactGroups clsBranchContactGroup = new ContactGroups(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            ContactGroupDetails clsContactGroupDetails;

            Data.Unit clsBranchUnit = new Data.Unit(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            UnitDetails clsUnitDetails;

            ProductGroup clsBranchProductGroup = new Data.ProductGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            ProductGroupDetails clsBranchProductGroupDetails;

            ProductSubGroup clsBranchProductSubGroup = new Data.ProductSubGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            ProductSubGroupDetails clsBranchProductSubGroupDetails;

            //Data.Variation clsBranchVariation = new Variation(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            Products clsBranchProduct = new Products(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            ProductDetails clsBranchProductDetails;

            ProductVariations clsBranchProductVariation = new ProductVariations(clsBranchInventory.Connection, clsBranchInventory.Transaction);
            ProductVariationDetails clsBranchProductVariationDetails;

            long lngBranchProductID = 0; long lngProductCtr = 0; long lngProductInserted = 0;

            while (xmlReader.Read())
            {
                switch (xmlReader.NodeType)
                {
                    case XmlNodeType.Element:

                        if (xmlReader.Name == "Item")
                        {
                            lngProductCtr++;

                            clsBranchProductDetails = new ProductDetails();
                            clsBranchProductDetails.BarCode = xmlReader.GetAttribute("BarCode");
                            clsBranchProductDetails.ProductCode = xmlReader.GetAttribute("ProductCode");
                            lblError.Text += "Checking <b>" + clsBranchProductDetails.ProductCode + "</b> if exist... ";

                            //check product by barcode
                            clsBranchProductDetails.ProductID = clsBranchProduct.Details(Constants.BRANCH_ID_MAIN, clsBranchProductDetails.BarCode).ProductID;
                            lngBranchProductID = clsBranchProductDetails.ProductID;
                            if (clsBranchProductDetails.ProductID != 0)
                            {
                                lblError.Text += " [Y] barcode exist... next item...<br />";
                                break;
                            }

                            //check product by product code
                            clsBranchProductDetails.ProductID = clsBranchProduct.Details(Constants.BRANCH_ID_MAIN, clsBranchProductDetails.ProductCode).ProductID;
                            lngBranchProductID = clsBranchProductDetails.ProductID;
                            if (clsBranchProductDetails.ProductID != 0)
                            {
                                clsBranchProduct.UpdateBarcode(clsBranchProductDetails.ProductID, clsBranchProductDetails.BarCode);
                                lblError.Text += " [Y] barcode not exist, product code exist. barcode updated. next item...<br />";
                                break;
                            }

                            lblError.Text += " [N] inserting product... ";

                            clsBranchProductDetails.BarCode = xmlReader.GetAttribute("BarCode");
                            clsBranchProductDetails.ProductDesc = xmlReader.GetAttribute("ProductDesc");
                            clsBranchProductDetails.ProductGroupCode = xmlReader.GetAttribute("ProductGroupCode");
                            clsBranchProductDetails.ProductGroupName = xmlReader.GetAttribute("ProductGroupName");
                            clsBranchProductDetails.ProductSubGroupCode = xmlReader.GetAttribute("ProductSubGroupCode");
                            clsBranchProductDetails.ProductSubGroupName = xmlReader.GetAttribute("ProductSubGroupName");
                            clsBranchProductDetails.BaseUnitCode = xmlReader.GetAttribute("BaseUnitCode");
                            clsBranchProductDetails.BaseUnitName = xmlReader.GetAttribute("BaseUnitName");
                            clsBranchProductDetails.DateCreated = DateTime.Now;
                            clsBranchProductDetails.Price = Convert.ToDecimal(xmlReader.GetAttribute("Price"));
                            clsBranchProductDetails.PurchasePrice = Convert.ToDecimal(xmlReader.GetAttribute("PurchasePrice"));
                            clsBranchProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(xmlReader.GetAttribute("IncludeInSubtotalDiscount"));
                            clsBranchProductDetails.VAT = Convert.ToDecimal(xmlReader.GetAttribute("VAT"));
                            clsBranchProductDetails.EVAT = Convert.ToDecimal(xmlReader.GetAttribute("EVAT"));
                            clsBranchProductDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("LocalTax"));
                            clsBranchProductDetails.Quantity = 0;
                            clsBranchProductDetails.MinThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MinThreshold"));
                            clsBranchProductDetails.MaxThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MaxThreshold"));
                            clsBranchProductDetails.ChartOfAccountIDPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDPurchase"));
                            clsBranchProductDetails.ChartOfAccountIDSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDSold"));
                            clsBranchProductDetails.ChartOfAccountIDInventory = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDInventory"));
                            clsBranchProductDetails.ChartOfAccountIDTaxPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxPurchase"));
                            clsBranchProductDetails.ChartOfAccountIDTaxSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxSold"));
                            clsBranchProductDetails.IsItemSold = Convert.ToBoolean(xmlReader.GetAttribute("IsItemSold"));
                            clsBranchProductDetails.WillPrintProductComposition = Convert.ToBoolean(xmlReader.GetAttribute("WillPrintProductComposition"));
                            clsBranchProductDetails.UpdatedBy = long.Parse(xmlReader.GetAttribute("UpdatedBy"));
                            clsBranchProductDetails.UpdatedOn = Convert.ToDateTime(xmlReader.GetAttribute("UpdatedOn"));
                            clsBranchProductDetails.PercentageCommision = decimal.Parse(xmlReader.GetAttribute("PercentageCommision"));
                            clsBranchProductDetails.QuantityIN = decimal.Parse(xmlReader.GetAttribute("QuantityIN"));
                            clsBranchProductDetails.QuantityOUT = decimal.Parse(xmlReader.GetAttribute("QuantityOUT"));

                            clsBranchProductDetails.SupplierCode = xmlReader.GetAttribute("ContactCode");
                            clsBranchProductDetails.SupplierID = clsBranchContact.Details(clsBranchProductDetails.SupplierCode).ContactID;
                            if (clsBranchProductDetails.SupplierID == 0)
                            {
                                clsBranchContactDetails = new ContactDetails();
                                clsBranchContactDetails.ContactGroupID = clsBranchContactGroup.Details(xmlReader.GetAttribute("ContactGroupCode")).ContactGroupID;
                                if (clsBranchContactDetails.ContactGroupID == 0)
                                {
                                    clsContactGroupDetails = new ContactGroupDetails();
                                    clsContactGroupDetails.ContactGroupCode = xmlReader.GetAttribute("ContactCode");
                                    clsContactGroupDetails.ContactGroupName = xmlReader.GetAttribute("ContactCode");
                                    clsContactGroupDetails.ContactGroupCategory = (ContactGroupCategory)Enum.Parse(typeof(ContactGroupCategory), xmlReader.GetAttribute("ContactGroupCategory"));
                                    clsBranchContactDetails.ContactGroupID = clsBranchContactGroup.Insert(clsContactGroupDetails);
                                }

                                clsBranchContactDetails.ContactCode = xmlReader.GetAttribute("ContactCode");
                                clsBranchContactDetails.ContactName = xmlReader.GetAttribute("ContactName");

                                clsBranchContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), xmlReader.GetAttribute("ModeOfTerms"));
                                clsBranchContactDetails.Terms = Convert.ToInt32(xmlReader.GetAttribute("Terms"));
                                clsBranchContactDetails.Address = xmlReader.GetAttribute("Address");
                                clsBranchContactDetails.BusinessName = xmlReader.GetAttribute("BusinessName");
                                clsBranchContactDetails.TelephoneNo = xmlReader.GetAttribute("TelephoneNo");
                                clsBranchContactDetails.Remarks = xmlReader.GetAttribute("Remarks");
                                clsBranchContactDetails.Debit = Convert.ToDecimal(xmlReader.GetAttribute("Debit"));
                                clsBranchContactDetails.Credit = Convert.ToDecimal(xmlReader.GetAttribute("Credit"));
                                clsBranchContactDetails.IsCreditAllowed = Convert.ToBoolean(xmlReader.GetAttribute("IsCreditAllowed"));
                                clsBranchContactDetails.CreditLimit = Convert.ToDecimal(xmlReader.GetAttribute("CreditLimit"));
                                clsBranchContactDetails.ContactID = clsBranchContact.Insert(clsBranchContactDetails);
                            }

                            clsBranchProductDetails.BaseUnitCode = xmlReader.GetAttribute("BaseUnitCode");
                            clsBranchProductDetails.BaseUnitID = clsBranchUnit.Details(clsBranchProductDetails.BaseUnitCode).UnitID;
                            if (clsBranchProductDetails.BaseUnitID == 0)
                            {
                                clsUnitDetails = new UnitDetails();
                                clsUnitDetails.UnitCode = xmlReader.GetAttribute("BaseUnitCode");
                                clsUnitDetails.UnitName = xmlReader.GetAttribute("BaseUnitName");
                                clsBranchProductDetails.BaseUnitID = clsBranchUnit.Insert(clsUnitDetails);
                            }


                            clsBranchProductDetails.ProductGroupCode = xmlReader.GetAttribute("ProductGroupCode");
                            clsBranchProductDetails.ProductGroupID = clsBranchProductGroup.Details(clsBranchProductDetails.ProductGroupCode).ProductGroupID;
                            if (clsBranchProductDetails.ProductGroupID == 0)
                            {
                                lblError.Text += "inserting product group....";
                                clsBranchProductGroupDetails = new ProductGroupDetails();
                                clsBranchProductGroupDetails.ProductGroupCode = xmlReader.GetAttribute("ProductGroupCode");
                                clsBranchProductGroupDetails.ProductGroupName = xmlReader.GetAttribute("ProductGroupName");
                                clsBranchProductGroupDetails.UnitDetails = new UnitDetails
                                {
                                    UnitID = clsBranchProductDetails.BaseUnitID
                                };
                                clsBranchProductGroupDetails.Price = clsBranchProductDetails.Price;
                                clsBranchProductGroupDetails.PurchasePrice = clsBranchProductDetails.PurchasePrice;
                                clsBranchProductGroupDetails.IncludeInSubtotalDiscount = clsBranchProductDetails.IncludeInSubtotalDiscount;
                                clsBranchProductGroupDetails.VAT = clsBranchProductDetails.VAT;
                                clsBranchProductGroupDetails.EVAT = clsBranchProductDetails.EVAT;
                                clsBranchProductGroupDetails.LocalTax = clsBranchProductDetails.LocalTax;
                                clsBranchProductDetails.ProductGroupID = clsBranchProductGroup.Insert(clsBranchProductGroupDetails);
                            }

                            clsBranchProductDetails.ProductSubGroupCode = xmlReader.GetAttribute("ProductSubGroupCode");
                            clsBranchProductDetails.ProductSubGroupID = clsBranchProductSubGroup.Details(clsBranchProductDetails.ProductSubGroupCode).ProductSubGroupID;
                            if (clsBranchProductDetails.ProductSubGroupID == 0)
                            {
                                lblError.Text += "inserting product sub-group....";
                                clsBranchProductSubGroupDetails = new ProductSubGroupDetails();
                                clsBranchProductSubGroupDetails.ProductGroupID = clsBranchProductDetails.ProductGroupID;
                                clsBranchProductSubGroupDetails.ProductSubGroupCode = xmlReader.GetAttribute("ProductSubGroupCode");
                                clsBranchProductSubGroupDetails.ProductSubGroupName = xmlReader.GetAttribute("ProductSubGroupName");
                                clsBranchProductSubGroupDetails.BaseUnitID = clsBranchProductDetails.BaseUnitID;
                                clsBranchProductSubGroupDetails.Price = clsBranchProductDetails.Price;
                                clsBranchProductSubGroupDetails.PurchasePrice = clsBranchProductDetails.PurchasePrice;
                                clsBranchProductSubGroupDetails.IncludeInSubtotalDiscount = clsBranchProductDetails.IncludeInSubtotalDiscount;
                                clsBranchProductSubGroupDetails.VAT = clsBranchProductDetails.VAT;
                                clsBranchProductSubGroupDetails.EVAT = clsBranchProductDetails.EVAT;
                                clsBranchProductSubGroupDetails.LocalTax = clsBranchProductDetails.LocalTax;
                                clsBranchProductDetails.ProductSubGroupID = clsBranchProductSubGroup.Insert(clsBranchProductSubGroupDetails);
                            }

                            clsBranchProductDetails.ProductID = clsBranchProduct.Insert(clsBranchProductDetails);
                            lngBranchProductID = clsBranchProductDetails.ProductID;
                            lngProductInserted++;

                            lblError.Text += " [done]. next item...<br />";
                        }
                        else if (xmlReader.Name == "Variation")
                        {
                            if (lngBranchProductID != 0)
                            {
                                clsBranchProductVariationDetails = new ProductVariationDetails();

                                clsBranchProductVariationDetails.VariationID = clsBranchProductVariation.Details(lngBranchProductID, xmlReader.GetAttribute("VariationCode")).VariationID;
                                if (clsBranchProductVariationDetails.VariationID == 0)
                                {
                                    clsBranchProductVariationDetails.ProductID = lngBranchProductID;
                                    clsBranchProductVariationDetails.VariationCode = xmlReader.GetAttribute("VariationCode");
                                    clsBranchProductVariationDetails.VariationType = xmlReader.GetAttribute("VariationType");

                                    clsBranchProductVariation.Insert(clsBranchProductVariationDetails);
                                }
                            }
                        }
                        else
                        {
                            lblError.Text += "<b>" + xmlReader.Name + ":</b>" + xmlReader.Value + "<br />";
                        }
                        break;
                    case XmlNodeType.Text:
                        lblError.Text += "<b>" + xmlReader.LocalName + ":</b>" + xmlReader.Value + "<br />";
                        break;
                }
            }
            xmlReader.Close();

            clsBranchInventory.CommitAndDispose();
            lblError.Text = "<b>" + lngProductInserted.ToString() + " out of " + lngProductCtr.ToString() + " has been successfully transferred.</b><br /><br />" + lblError.Text;
        }
Exemplo n.º 15
0
		private void SetDataSource(ReportDocument Report)
		{
            ReportDataset rptds = new ReportDataset();

            //long lngProductGroupName = long.Parse(cboProductGroup.SelectedItem.Value);
            //long lngSubGroupName = long.Parse(cboSubGroup.SelectedItem.Value);

            string ProductGroupName = string.Empty;
            if (cboProductGroup.SelectedItem.Value != Constants.ZERO_STRING) ProductGroupName = cboProductGroup.SelectedItem.Value;
            string SubGroupName = string.Empty;
            if (cboSubGroup.SelectedItem.Value != Constants.ZERO_STRING) SubGroupName = cboSubGroup.SelectedItem.Value;

            string ReportType = cboReportType.SelectedItem.Text;

            ProductColumns clsProductColumns = new ProductColumns();
            #region clsProductColumns
            clsProductColumns.ProductCode = true;
            clsProductColumns.BarCode = true;
            clsProductColumns.BarCode2 = true;
            clsProductColumns.BarCode3 = true;
            clsProductColumns.ProductDesc = true;
            clsProductColumns.ProductSubGroupName = true;
            clsProductColumns.BaseUnitName = true;
            clsProductColumns.UnitName = true;
            clsProductColumns.ProductGroupName = true;
            clsProductColumns.DateCreated = true;
            clsProductColumns.Price = true;
            clsProductColumns.Quantity = true;
            clsProductColumns.MinThreshold = true;
            clsProductColumns.MaxThreshold = true;
            clsProductColumns.PurchasePrice = true;
            clsProductColumns.SupplierName = true;
            clsProductColumns.QuantityIN = true;
            clsProductColumns.QuantityOUT = true;
            clsProductColumns.RIDMinThreshold = true;
            clsProductColumns.RIDMaxThreshold = true;
            clsProductColumns.RID = true;
            //clsProductColumns.BranchActualQuantity = true;
            //clsProductColumns.BranchQuantity = true;
            //clsProductColumns.BranchQuantityIN = true;
            //clsProductColumns.BranchQuantityOUT = true;
            #endregion

            ProductDetails clsSearchKey = new ProductDetails();
            #region Search Key
            clsSearchKey.BranchID = Convert.ToInt32(cboBranch.SelectedItem.Value);
            clsSearchKey.SupplierID = Convert.ToInt32(cboContact.SelectedItem.Value);
            clsSearchKey.ProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            clsSearchKey.ProductSubGroupID = Convert.ToInt64(cboSubGroup.SelectedItem.Value);
            clsSearchKey.ProductCode = txtProductCode.Text;
            #endregion

            Products clsProduct = new Products();
            clsProduct.GetConnection();
            ProductInventories clsProductInventories = new ProductInventories(clsProduct.Connection, clsProduct.Transaction);

            
            DataTable dt;
            string ProductIDs = null;

            switch (cboReportType.SelectedValue)
            {
                case ReportTypes.ProductList:
                    #region Products List
                    dt = clsProductInventories.ListAsDataTable(Int32.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text);
                    clsProduct.CommitAndDispose();

                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Products.NewRow();

                        foreach (DataColumn dc in rptds.Products.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Products.Rows.Add(drNew);
                    }
                    break;
                    #endregion

                case ReportTypes.ProductPriceList:
                    #region Products Price List
                    dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text);
                    clsProduct.CommitAndDispose();
                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Products.NewRow();

                        foreach (DataColumn dc in rptds.Products.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Products.Rows.Add(drNew);
                        ProductIDs += dr["ProductID"].ToString() + ",";
                    }
                    break;
                    #endregion

                case ReportTypes.ProductListWithInvalidMatrix:
                    #region Products List With Invalid Unit Matrix
                    dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text, ShowOnlyWithInvalidUnitMatrix: true);
                    clsProduct.CommitAndDispose();

                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        DataRow drNew = rptds.Products.NewRow();

                        foreach (DataColumn dc in rptds.Products.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.Products.Rows.Add(drNew);
                    }
                    break;
                    #endregion
                case ReportTypes.WeightedProductsForWeighingScale:
                case ReportTypes.CountedProductsForWeighingScale:
                    #region Weighted and Counted Products For Weighing Scale
                    dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text);
                    clsProduct.CommitAndDispose();
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr[ProductColumnNames.BarCode].ToString() != null && dr[ProductColumnNames.BarCode].ToString() != string.Empty)
                        {
                            DataRow drNew = rptds.Products.NewRow();

                            foreach (DataColumn dc in rptds.Products.Columns)
                                drNew[dc] = dr[dc.ColumnName];

                            rptds.Products.Rows.Add(drNew);
                            ProductIDs += dr["ProductID"].ToString() + ",";
                        }
                    }
                    break;
                    #endregion

                case ReportTypes.ProductsInDemoReport:
                    #region Products In Demo
                    DateTime StartTransactionDate = DateTime.TryParse(txtStartDate.Text + " " + txtStartTime.Text, out StartTransactionDate) ? StartTransactionDate : DateTime.MinValue;
                    DateTime EndTransactionDate = DateTime.TryParse(txtEndDate.Text + " " + txtEndTime.Text, out EndTransactionDate) ? EndTransactionDate : DateTime.MinValue;

                    SalesTransactionItems clsSalesTransactionItemsDemo = new SalesTransactionItems();
                    System.Data.DataTable dtDemo = clsSalesTransactionItemsDemo.ProductsInDemoReport(Int32.Parse(cboBranch.SelectedItem.Value), Int64.Parse(cboContact.SelectedItem.Value), cboProductGroup.SelectedItem.Text, cboSubGroup.SelectedItem.Text, txtProductCode.Text, "", StartTransactionDate, EndTransactionDate);
                    clsSalesTransactionItemsDemo.CommitAndDispose();
                    foreach (DataRow dr in dtDemo.Rows)
                    {
                        DataRow drNew = rptds.ProductsInDemo.NewRow();

                        foreach (DataColumn dc in rptds.ProductsInDemo.Columns)
                            drNew[dc] = dr[dc.ColumnName];

                        rptds.ProductsInDemo.Rows.Add(drNew);
                    }
                    break;
                    #endregion
                default:
                    return;

            }

            Report.SetDataSource(rptds); 
			SetParameters(Report);
		}
Exemplo n.º 16
0
		public void InheritSubGroupVariationsMatrix(Int64 ProductSubGroupID, Int64 ProductID, ProductDetails prodDetails)
		{
			try 
			{	
				

				ProductBaseVariationsMatrixDetails clsBaseDetails;

				ProductSubGroupVariationsMatrix clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix(base.Connection, base.Transaction);

				ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);
				ProductVariationsMatrixDetails  clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails();

				MySqlDataReader clsProductSubGroupVariationsMatrixList;
				MySqlDataReader clsProductSubGroupBaseVariationsMatrixList = clsProductSubGroupVariationsMatrix.BaseList(ProductSubGroupID,"MatrixID",SortOption.Ascending);

				Int64 SubGroupBaseMatrixID = 0;

				while (clsProductSubGroupBaseVariationsMatrixList.Read())
				{
					clsBaseDetails = new ProductBaseVariationsMatrixDetails();
					clsBaseDetails.ProductID = ProductID;
					clsBaseDetails.Description = "" + clsProductSubGroupBaseVariationsMatrixList["Description"].ToString();
					clsBaseDetails.UnitID = Convert.ToInt32(clsProductSubGroupBaseVariationsMatrixList["UnitID"]);
					clsBaseDetails.Price = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["Price"]);
					clsBaseDetails.WSPrice = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["WSPrice"]);
					clsBaseDetails.PurchasePrice = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["PurchasePrice"]);
					clsBaseDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(clsProductSubGroupBaseVariationsMatrixList["IncludeInSubtotalDiscount"]);
					clsBaseDetails.VAT = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["VAT"]);
					clsBaseDetails.EVAT = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["EVAT"]);
					clsBaseDetails.LocalTax = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["LocalTax"]);
					clsBaseDetails.Quantity = 0;
					clsBaseDetails.MinThreshold = prodDetails.MinThreshold;
					clsBaseDetails.MaxThreshold = prodDetails.MaxThreshold;

					clsBaseDetails.MatrixID = clsProductVariationsMatrix.InsertBaseVariation(clsBaseDetails);

					SubGroupBaseMatrixID = clsProductSubGroupBaseVariationsMatrixList.GetInt64(0);
					clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix(base.Connection, base.Transaction);
					clsProductSubGroupVariationsMatrixList =  clsProductSubGroupVariationsMatrix.List(SubGroupBaseMatrixID);

					while (clsProductSubGroupVariationsMatrixList.Read())
					{
						clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails();
						clsProductVariationsMatrixDetails.MatrixID = clsBaseDetails.MatrixID;
						clsProductVariationsMatrixDetails.ProductID = ProductID;
						clsProductVariationsMatrixDetails.VariationID = Convert.ToInt64(clsProductSubGroupVariationsMatrixList["VariationID"]);
						clsProductVariationsMatrixDetails.Description = "" + clsProductSubGroupVariationsMatrixList["Description"].ToString();
						clsProductVariationsMatrix.SaveVariation(clsProductVariationsMatrixDetails);
					}
					clsProductSubGroupVariationsMatrixList.Close(); 

				}
				clsProductSubGroupBaseVariationsMatrixList.Close();

			}
				
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemplo n.º 17
0
		protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (cboProductCode.Items.Count == 0)
				return;

			DataClass clsDataClass = new DataClass();
			long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            if (ProductID == 0) {
                cboVariation.Items.Clear();
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
                return; 
            }

			ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
			cboVariation.DataTextField = "VariationDesc";
			cboVariation.DataValueField = "MatrixID";
			cboVariation.DataSource = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
			cboVariation.DataBind();

			if (cboVariation.Items.Count == 0)
			{
				cboVariation.Items.Add(new ListItem("No Variation", "0"));
			}
			cboVariation.SelectedIndex = cboVariation.Items.Count - 1;
			clsProductVariationsMatrix.CommitAndDispose();

			ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix();

			cboProductUnit.DataTextField = "BottomUnitCode";
			cboProductUnit.DataValueField = "BottomUnitID";
			cboProductUnit.DataSource = clsUnitMatrix.ListAsDataTable(ProductID,"a.MatrixID",SortOption.Ascending).DefaultView;
			cboProductUnit.DataBind();
			clsUnitMatrix.CommitAndDispose();

			Products clsProduct = new Products();
			ProductDetails clsDetails = new ProductDetails();
			clsDetails = clsProduct.Details(ProductID);
			clsProduct.CommitAndDispose();
			cboProductUnit.Items.Add( new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

			cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1;

			cboVariation_SelectedIndexChanged(null, null);
		}
Exemplo n.º 18
0
        private void CreateDefaultProduct(string DefaultProduct)
        {
            try
            {
                ProductDetails clsDetails = new ProductDetails();

                clsDetails.ProductCode = DefaultProduct;
                clsDetails.ProductDesc = DefaultProduct;
                clsDetails.BarCode = DefaultProduct;
                clsDetails.BarCode2 = "";
                clsDetails.BarCode3 = "";
                clsDetails.ProductGroupID = ProductGroup.DEFAULT_GROUP_ID;
                clsDetails.ProductSubGroupID = ProductSubGroup.DEFAULT_SUB_GROUP_ID;

                clsDetails.BaseUnitID = Unit.DEFAULT_UNIT_ID;
                clsDetails.Price = 1;
                clsDetails.Price1 = 1;
                clsDetails.Price2 = 1;
                clsDetails.Price3 = 1;
                clsDetails.Price4 = 1;
                clsDetails.Price5 = 1;
                clsDetails.WSPrice = 1;
                clsDetails.PurchasePrice = 1;
                clsDetails.PercentageCommision = 0;
                clsDetails.IncludeInSubtotalDiscount = true;
                clsDetails.IsCreditChargeExcluded = false;
                clsDetails.Quantity = 9999999999;
                clsDetails.VAT = 0;
                clsDetails.EVAT = 0;
                clsDetails.LocalTax = 0;
                clsDetails.MinThreshold = 0;
                clsDetails.MaxThreshold = 0;
                clsDetails.SupplierID = Contacts.DEFAULT_SUPPLIER_ID;
                clsDetails.IsItemSold = false;
                clsDetails.WillPrintProductComposition = false;
                clsDetails.UpdatedBy = 1;
                clsDetails.UpdatedOn = DateTime.Now;
                clsDetails.RID = 0;

                Insert(clsDetails);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 19
0
        private void Import()
        {
            if (txtPath.HasFile)
            {
                string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);

                if (fn.Contains("_" + Constants.PURCHASE_ORDER_CODE) == false)
                {
                    string stScript = "<Script>";
                    stScript += "window.alert('Please select a VALID Transfer In file to upload.')";
                    stScript += "</Script>";
                    Response.Write(stScript);
                    return;
                }

                string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;

                txtPath.PostedFile.SaveAs(SaveLocation);
                XmlTextReader xmlReader = new XmlTextReader(SaveLocation);
                xmlReader.WhitespaceHandling = WhitespaceHandling.None;

                TransferOut clsTransferOut = new TransferOut();
                clsTransferOut.GetConnection();
                TransferOutDetails clsTransferOutDetails = new TransferOutDetails();

                TransferOutItem clsTransferOutItem = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
                TransferOutItemDetails clsTransferOutItemDetails;

                Contacts clsContact = new Contacts(clsTransferOut.Connection, clsTransferOut.Transaction);
                ContactDetails clsContactDetails;

                ContactGroups clsContactGroup = new ContactGroups(clsTransferOut.Connection, clsTransferOut.Transaction);
                ContactGroupDetails clsContactGroupDetails;

                Data.Unit clsUnit = new Data.Unit(clsTransferOut.Connection, clsTransferOut.Transaction);
                UnitDetails clsUnitDetails;

                ProductGroup clsProductGroup = new Data.ProductGroup(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductGroupDetails clsProductGroupDetails;

                ProductSubGroup clsProductSubGroup = new Data.ProductSubGroup(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductSubGroupDetails clsProductSubGroupDetails;

                Products clsProduct = new Products(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductDetails clsProductDetails;

                ProductVariations clsProductVariation = new ProductVariations(clsTransferOut.Connection, clsTransferOut.Transaction);
                ProductVariationDetails clsProductVariationDetails;

                Branch clsBranch = new Branch(clsTransferOut.Connection, clsTransferOut.Transaction);
                BranchDetails clsBranchDetails;

                long lngProductID = 0; long lngProductCtr = 0;

                while (xmlReader.Read())
                {
                    switch (xmlReader.NodeType)
                    {
                        case XmlNodeType.Element:

                            if (xmlReader.Name == "TransferOutDetails")
                            {
                                clsTransferOutDetails.TransferOutNo = lnkTransferOutNo.Text;
                                clsTransferOutDetails.TransferOutDate = DateTime.Parse(lblTransferOutDate.Text);

                                clsTransferOutDetails.SupplierCode = xmlReader.GetAttribute("SupplierCode").ToString();
                                clsTransferOutDetails.SupplierContact = xmlReader.GetAttribute("SupplierContact").ToString();
                                clsTransferOutDetails.SupplierAddress = xmlReader.GetAttribute("SupplierAddress").ToString();
                                clsTransferOutDetails.SupplierTelephoneNo = xmlReader.GetAttribute("SupplierTelephoneNo").ToString();
                                clsTransferOutDetails.SupplierModeOfTerms = int.Parse(xmlReader.GetAttribute("SupplierModeOfTerms").ToString());
                                clsTransferOutDetails.SupplierTerms = int.Parse(xmlReader.GetAttribute("SupplierTerms").ToString());
                                clsTransferOutDetails.SupplierID = clsContact.Details(xmlReader.GetAttribute("SupplierCode").ToString()).ContactID;
                                if (clsTransferOutDetails.SupplierID == 0)
                                {
                                    clsContactDetails = new ContactDetails();
                                    clsContactDetails.ContactCode = clsTransferOutDetails.SupplierCode;
                                    clsContactDetails.ContactName = xmlReader.GetAttribute("SupplierName").ToString();
                                    clsContactDetails.BusinessName = clsTransferOutDetails.SupplierContact;
                                    clsContactDetails.Address = clsTransferOutDetails.SupplierAddress;
                                    clsContactDetails.TelephoneNo = clsTransferOutDetails.SupplierTelephoneNo;
                                    clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), clsTransferOutDetails.SupplierModeOfTerms.ToString());
                                    clsContactDetails.Terms = clsTransferOutDetails.SupplierTerms;
                                    clsContactDetails.Remarks = "Added in from Imported TransferOut #";
                                    clsContactDetails.ContactGroupID = int.Parse(Contacts.DEFAULT_SUPPLIER_ID.ToString("d"));
                                    clsContactDetails.DateCreated = DateTime.Now;
                                    clsTransferOutDetails.SupplierID = clsContact.Insert(clsContactDetails);
                                }
                                clsTransferOutDetails.RequiredDeliveryDate = DateTime.Parse(xmlReader.GetAttribute("RequiredDeliveryDate").ToString());
                                clsTransferOutDetails.BranchID = clsBranch.Details(xmlReader.GetAttribute("BranchCode")).BranchID;
                                if (clsTransferOutDetails.BranchID == 0)
                                {
                                    clsBranchDetails = new BranchDetails();
                                    clsBranchDetails.BranchCode = xmlReader.GetAttribute("BranchCode");
                                    clsBranchDetails.BranchName = xmlReader.GetAttribute("BranchName");
                                    clsBranchDetails.Address = xmlReader.GetAttribute("BranchAddress");
                                    clsBranchDetails.DBIP = xmlReader.GetAttribute("BranchDBIP");
                                    clsBranchDetails.DBPort = xmlReader.GetAttribute("BranchDBPort");
                                    clsBranchDetails.Remarks = xmlReader.GetAttribute("BranchRemarks");
                                    clsTransferOutDetails.BranchID = clsBranch.Insert(clsBranchDetails);
                                }

                                clsTransferOutDetails.TransferrerID = long.Parse(xmlReader.GetAttribute("TransferrerID"));
                                clsTransferOutDetails.TransferrerName = xmlReader.GetAttribute("TransferrerName");

                                clsTransferOutDetails.SubTotal = decimal.Parse(xmlReader.GetAttribute("SubTotal"));
                                clsTransferOutDetails.Discount = decimal.Parse(xmlReader.GetAttribute("Discount"));
                                clsTransferOutDetails.DiscountApplied = decimal.Parse(xmlReader.GetAttribute("DiscountApplied"));
                                clsTransferOutDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), xmlReader.GetAttribute("DiscountType"));
                                clsTransferOutDetails.VAT = decimal.Parse(xmlReader.GetAttribute("VAT"));
                                clsTransferOutDetails.VatableAmount = decimal.Parse(xmlReader.GetAttribute("VatableAmount"));
                                clsTransferOutDetails.EVAT = decimal.Parse(xmlReader.GetAttribute("EVAT"));
                                clsTransferOutDetails.EVatableAmount = decimal.Parse(xmlReader.GetAttribute("EVatableAmount"));
                                clsTransferOutDetails.LocalTax = decimal.Parse(xmlReader.GetAttribute("LocalTax"));
                                clsTransferOutDetails.Freight = decimal.Parse(xmlReader.GetAttribute("Freight"));
                                clsTransferOutDetails.Deposit = decimal.Parse(xmlReader.GetAttribute("Deposit"));
                                clsTransferOutDetails.UnpaidAmount = decimal.Parse(xmlReader.GetAttribute("UnpaidAmount"));
                                clsTransferOutDetails.PaidAmount = decimal.Parse(xmlReader.GetAttribute("PaidAmount"));
                                clsTransferOutDetails.TotalItemDiscount = decimal.Parse(xmlReader.GetAttribute("TotalItemDiscount"));
                                clsTransferOutDetails.Status = (TransferOutStatus)Enum.Parse(typeof(TransferOutStatus), xmlReader.GetAttribute("Status"));
                                clsTransferOutDetails.Remarks = xmlReader.GetAttribute("Remarks");
                                clsTransferOutDetails.SupplierDRNo = xmlReader.GetAttribute("SupplierDRNo");
                                clsTransferOutDetails.DeliveryDate = DateTime.Parse(xmlReader.GetAttribute("DeliveryDate"));
                                clsTransferOutDetails.CancelledDate = DateTime.Parse(xmlReader.GetAttribute("CancelledDate"));
                                clsTransferOutDetails.Remarks = xmlReader.GetAttribute("Remarks");
                                clsTransferOutDetails.CancelledRemarks = xmlReader.GetAttribute("CancelledRemarks");
                                clsTransferOutDetails.CancelledByID = long.Parse(xmlReader.GetAttribute("CancelledByID"));

                                clsTransferOut.Update(clsTransferOutDetails);

                            }
                            else if (xmlReader.Name == "TransferOutItem")
                            {
                                clsTransferOutItemDetails = new TransferOutItemDetails();
                                clsTransferOutItemDetails.TransferOutID = long.Parse(lblTransferOutID.Text);

                                clsTransferOutItemDetails.ProductCode = xmlReader.GetAttribute("ProductCode");
                                clsTransferOutItemDetails.BarCode = xmlReader.GetAttribute("BarCode");
                                clsTransferOutItemDetails.Description = xmlReader.GetAttribute("ProductDesc");
                                clsTransferOutItemDetails.ProductSubGroup = xmlReader.GetAttribute("ItemProductSubGroup");
                                clsTransferOutItemDetails.ProductGroup = xmlReader.GetAttribute("ItemProductGroup");
                                clsTransferOutItemDetails.ProductUnitID = Convert.ToInt32(xmlReader.GetAttribute("ItemProductUnitID"));
                                clsTransferOutItemDetails.ProductUnitCode = xmlReader.GetAttribute("ItemProductUnitCode");
                                clsTransferOutItemDetails.Quantity = Convert.ToDecimal(xmlReader.GetAttribute("ItemQuantity"));
                                clsTransferOutItemDetails.UnitCost = Convert.ToDecimal(xmlReader.GetAttribute("ItemUnitCost"));
                                clsTransferOutItemDetails.Discount = Convert.ToDecimal(xmlReader.GetAttribute("ItemDiscount"));
                                clsTransferOutItemDetails.DiscountApplied = Convert.ToDecimal(xmlReader.GetAttribute("ItemDiscountApplied"));
                                clsTransferOutItemDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), xmlReader.GetAttribute("ItemDiscountType"));
                                clsTransferOutItemDetails.Amount = Convert.ToDecimal(xmlReader.GetAttribute("ItemAmount"));
                                clsTransferOutItemDetails.IsVatable = Convert.ToBoolean(Convert.ToInt16(xmlReader.GetAttribute("ItemIsVatable")));
                                clsTransferOutItemDetails.VatableAmount = Convert.ToDecimal(xmlReader.GetAttribute("ItemVatableAmount"));
                                clsTransferOutItemDetails.EVatableAmount = Convert.ToDecimal(xmlReader.GetAttribute("ItemEVatableAmount"));
                                clsTransferOutItemDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("ItemLocalTax"));
                                clsTransferOutItemDetails.VAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemVAT"));
                                clsTransferOutItemDetails.EVAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemEVAT"));
                                clsTransferOutItemDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("ItemLocalTax"));
                                clsTransferOutItemDetails.isVATInclusive = Convert.ToBoolean(Convert.ToInt16(xmlReader.GetAttribute("ItemisVATInclusive")));
                                clsTransferOutItemDetails.IsVatable = Convert.ToBoolean(Convert.ToInt16(xmlReader.GetAttribute("ItemIsVatable")));
                                clsTransferOutItemDetails.TransferOutItemStatus = (TransferOutItemStatus)Enum.Parse(typeof(TransferOutItemStatus), xmlReader.GetAttribute("ItemTransferOutItemStatus"));
                                clsTransferOutItemDetails.VariationMatrixID = Convert.ToInt64(xmlReader.GetAttribute("ItemVariationMatrixID"));
                                clsTransferOutItemDetails.MatrixDescription = xmlReader.GetAttribute("ItemBaseVariationDescription");
                                clsTransferOutItemDetails.ProductGroup = xmlReader.GetAttribute("ProductGroup");
                                clsTransferOutItemDetails.ProductSubGroup = xmlReader.GetAttribute("ProductSubGroup");
                                clsTransferOutItemDetails.Remarks = xmlReader.GetAttribute("ItemRemarks");
                                clsTransferOutItemDetails.SellingPrice = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingPrice"));
                                clsTransferOutItemDetails.SellingVAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingVAT"));
                                clsTransferOutItemDetails.SellingEVAT = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingEVAT"));
                                clsTransferOutItemDetails.SellingLocalTax = Convert.ToDecimal(xmlReader.GetAttribute("ItemSellingLocalTax"));
                                clsTransferOutItemDetails.OldSellingPrice = Convert.ToDecimal(xmlReader.GetAttribute("ItemOldSellingPrice"));

                                clsTransferOutItemDetails.ProductID = clsProduct.Details(clsTransferOutItemDetails.BarCode).ProductID;
                                lngProductID = clsTransferOutItemDetails.ProductID;
                                if (clsTransferOutItemDetails.ProductID == 0)
                                {
                                    clsTransferOutItemDetails.ProductID = clsProduct.Details(clsTransferOutItemDetails.ProductCode).ProductID;
                                    if (clsTransferOutItemDetails.ProductID == 0)
                                    {
                                        //insert new product
                                        clsProductDetails = new ProductDetails();
                                        clsProductDetails.BarCode = clsTransferOutItemDetails.BarCode;
                                        clsProductDetails.ProductCode = clsTransferOutItemDetails.ProductCode;
                                        clsProductDetails.ProductDesc = clsTransferOutItemDetails.Description;
                                        clsProductDetails.ProductGroupCode = xmlReader.GetAttribute("ProductGroupCode");
                                        clsProductDetails.ProductGroupName = xmlReader.GetAttribute("ProductGroupName");
                                        clsProductDetails.ProductSubGroupCode = xmlReader.GetAttribute("ProductSubGroupCode");
                                        clsProductDetails.ProductSubGroupName = xmlReader.GetAttribute("ProductSubGroupName");
                                        clsProductDetails.BaseUnitCode = xmlReader.GetAttribute("BaseUnitCode");
                                        clsProductDetails.BaseUnitName = xmlReader.GetAttribute("BaseUnitName");
                                        clsProductDetails.DateCreated = DateTime.Now;
                                        clsProductDetails.Price = Convert.ToDecimal(xmlReader.GetAttribute("Price"));
                                        clsProductDetails.PurchasePrice = Convert.ToDecimal(xmlReader.GetAttribute("PurchasePrice"));
                                        clsProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(xmlReader.GetAttribute("IncludeInSubtotalDiscount"));
                                        clsProductDetails.VAT = Convert.ToDecimal(xmlReader.GetAttribute("VAT"));
                                        clsProductDetails.EVAT = Convert.ToDecimal(xmlReader.GetAttribute("EVAT"));
                                        clsProductDetails.LocalTax = Convert.ToDecimal(xmlReader.GetAttribute("LocalTax"));
                                        clsProductDetails.Quantity = 0;
                                        clsProductDetails.MinThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MinThreshold"));
                                        clsProductDetails.MaxThreshold = Convert.ToDecimal(xmlReader.GetAttribute("MaxThreshold"));
                                        clsProductDetails.ChartOfAccountIDPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDPurchase"));
                                        clsProductDetails.ChartOfAccountIDSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDSold"));
                                        clsProductDetails.ChartOfAccountIDInventory = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDInventory"));
                                        clsProductDetails.ChartOfAccountIDTaxPurchase = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxPurchase"));
                                        clsProductDetails.ChartOfAccountIDTaxSold = int.Parse(xmlReader.GetAttribute("ChartOfAccountIDTaxSold"));
                                        clsProductDetails.IsItemSold = Convert.ToBoolean(xmlReader.GetAttribute("IsItemSold"));
                                        clsProductDetails.WillPrintProductComposition = Convert.ToBoolean(xmlReader.GetAttribute("WillPrintProductComposition"));
                                        clsProductDetails.UpdatedBy = long.Parse(xmlReader.GetAttribute("UpdatedBy"));
                                        clsProductDetails.UpdatedOn = Convert.ToDateTime(xmlReader.GetAttribute("UpdatedOn"));
                                        clsProductDetails.PercentageCommision = decimal.Parse(xmlReader.GetAttribute("PercentageCommision"));
                                        clsProductDetails.QuantityIN = clsProductDetails.Quantity;
                                        clsProductDetails.QuantityOUT = 0;

                                        clsProductDetails.SupplierCode = clsTransferOutDetails.SupplierCode;
                                        clsProductDetails.SupplierID = clsContact.Details(clsProductDetails.SupplierCode).ContactID;
                                        if (clsProductDetails.SupplierID == 0)
                                        {
                                            clsContactDetails = new ContactDetails();
                                            clsContactDetails.ContactGroupID = clsContactGroup.Details(int.Parse(ContactGroupCategory.SUPPLIER.ToString("d"))).ContactGroupID;
                                            if (clsContactDetails.ContactGroupID == 0)
                                            {
                                                clsContactGroupDetails = new ContactGroupDetails();
                                                clsContactGroupDetails.ContactGroupCode = xmlReader.GetAttribute("SUP");
                                                clsContactGroupDetails.ContactGroupName = xmlReader.GetAttribute("Default Supplier Group");
                                                clsContactGroupDetails.ContactGroupCategory = ContactGroupCategory.SUPPLIER;
                                                clsContactDetails.ContactGroupID = clsContactGroup.Insert(clsContactGroupDetails);
                                            }

                                            clsContactDetails.ContactCode = clsTransferOutDetails.SupplierCode;
                                            clsContactDetails.ContactName = clsTransferOutDetails.SupplierContact;

                                            clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), clsTransferOutDetails.SupplierModeOfTerms.ToString());
                                            clsContactDetails.Terms = clsTransferOutDetails.SupplierTerms;
                                            clsContactDetails.Address = clsTransferOutDetails.SupplierAddress;
                                            clsContactDetails.BusinessName = clsTransferOutDetails.SupplierContact;
                                            clsContactDetails.TelephoneNo = clsTransferOutDetails.SupplierTelephoneNo;
                                            clsContactDetails.Remarks = "Added in XML import";
                                            clsContactDetails.Debit = 0;
                                            clsContactDetails.Credit = 0;
                                            clsContactDetails.IsCreditAllowed = false;
                                            clsContactDetails.CreditLimit = 0;
                                            clsProductDetails.SupplierID = clsContact.Insert(clsContactDetails);
                                        }

                                        clsProductDetails.BaseUnitID = clsUnit.Details(clsProductDetails.BaseUnitCode).UnitID;
                                        if (clsProductDetails.BaseUnitID == 0)
                                        {
                                            clsUnitDetails = new UnitDetails();
                                            clsUnitDetails.UnitCode = clsProductDetails.BaseUnitCode;
                                            clsUnitDetails.UnitName = clsProductDetails.BaseUnitName;
                                            clsProductDetails.BaseUnitID = clsUnit.Insert(clsUnitDetails);
                                        }

                                        clsProductDetails.ProductGroupID = clsProductGroup.Details(clsProductDetails.ProductGroupCode).ProductGroupID;
                                        if (clsProductDetails.ProductGroupID == 0)
                                        {
                                            clsProductGroupDetails = new ProductGroupDetails();
                                            clsProductGroupDetails.ProductGroupCode = clsProductDetails.ProductGroupCode;
                                            clsProductGroupDetails.ProductGroupName = clsProductDetails.ProductGroupName;
                                            clsProductGroupDetails.UnitDetails = new UnitDetails
                                            {
                                                UnitID = clsProductDetails.BaseUnitID
                                            };
                                            clsProductGroupDetails.Price = clsProductDetails.Price;
                                            clsProductGroupDetails.PurchasePrice = clsProductDetails.PurchasePrice;
                                            clsProductGroupDetails.IncludeInSubtotalDiscount = clsProductDetails.IncludeInSubtotalDiscount;
                                            clsProductGroupDetails.VAT = clsProductDetails.VAT;
                                            clsProductGroupDetails.EVAT = clsProductDetails.EVAT;
                                            clsProductGroupDetails.LocalTax = clsProductDetails.LocalTax;
                                            clsProductDetails.ProductGroupID = clsProductGroup.Insert(clsProductGroupDetails);
                                        }

                                        clsProductDetails.ProductSubGroupID = clsProductSubGroup.Details(clsProductDetails.ProductSubGroupCode).ProductSubGroupID;
                                        if (clsProductDetails.ProductSubGroupID == 0)
                                        {
                                            clsProductSubGroupDetails = new ProductSubGroupDetails();
                                            clsProductSubGroupDetails.ProductGroupID = clsProductDetails.ProductGroupID;
                                            clsProductSubGroupDetails.ProductSubGroupCode = clsProductDetails.ProductSubGroupCode;
                                            clsProductSubGroupDetails.ProductSubGroupName = clsProductDetails.ProductSubGroupName;
                                            clsProductSubGroupDetails.BaseUnitID = clsProductDetails.BaseUnitID;
                                            clsProductSubGroupDetails.Price = clsProductDetails.Price;
                                            clsProductSubGroupDetails.PurchasePrice = clsProductDetails.PurchasePrice;
                                            clsProductSubGroupDetails.IncludeInSubtotalDiscount = clsProductDetails.IncludeInSubtotalDiscount;
                                            clsProductSubGroupDetails.VAT = clsProductDetails.VAT;
                                            clsProductSubGroupDetails.EVAT = clsProductDetails.EVAT;
                                            clsProductSubGroupDetails.LocalTax = clsProductDetails.LocalTax;
                                            clsProductDetails.ProductSubGroupID = clsProductSubGroup.Insert(clsProductSubGroupDetails);
                                        }

                                        clsTransferOutItemDetails.ProductID = clsProduct.Insert(clsProductDetails);
                                    }
                                    else
                                    {
                                        //product code already exist but not the same barcode
                                        clsProduct.UpdateBarcode(clsTransferOutItemDetails.ProductID, clsTransferOutItemDetails.BarCode);
                                    }
                                    lngProductID = clsTransferOutItemDetails.ProductID;
                                }

                                clsTransferOutItem.Insert(clsTransferOutItemDetails);

                                clsTransferOutDetails = new TransferOutDetails();
                                clsTransferOutDetails.TransferOutID = clsTransferOutItemDetails.TransferOutID;
                                clsTransferOutDetails.DiscountApplied = Convert.ToDecimal(txtTransferOutDiscountApplied.Text);
                                clsTransferOutDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscountType.SelectedItem.Value);

                                clsTransferOutDetails.Discount2Applied = Convert.ToDecimal(txtTransferOutDiscount2Applied.Text);
                                clsTransferOutDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount2Type.SelectedItem.Value);

                                clsTransferOutDetails.Discount3Applied = Convert.ToDecimal(txtTransferOutDiscount2Applied.Text);
                                clsTransferOutDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboTransferOutDiscount3Type.SelectedItem.Value);

                                clsTransferOut = new TransferOut(clsTransferOutItem.Connection, clsTransferOutItem.Transaction);
                                clsTransferOut.UpdateDiscount(clsTransferOutItemDetails.TransferOutID, clsTransferOutDetails.DiscountApplied, clsTransferOutDetails.DiscountType, clsTransferOutDetails.Discount2Applied, clsTransferOutDetails.Discount2Type, clsTransferOutDetails.Discount3Applied, clsTransferOutDetails.Discount3Type);

                                clsTransferOutDetails = clsTransferOut.Details(clsTransferOutItemDetails.TransferOutID);
                                UpdateFooter(clsTransferOutDetails);

                                lngProductCtr++;
                            }
                            else if (xmlReader.Name == "Variation")
                            {
                                if (lngProductID != 0)
                                {
                                    clsProductVariationDetails = new ProductVariationDetails();

                                    clsProductVariationDetails.VariationID = clsProductVariation.Details(lngProductID, xmlReader.GetAttribute("VariationCode")).VariationID;
                                    if (clsProductVariationDetails.VariationID == 0)
                                    {
                                        clsProductVariationDetails.ProductID = lngProductID;
                                        clsProductVariationDetails.VariationCode = xmlReader.GetAttribute("VariationCode");
                                        clsProductVariationDetails.VariationType = xmlReader.GetAttribute("VariationType");

                                        clsProductVariation.Insert(clsProductVariationDetails);
                                    }
                                }
                            }
                            else
                            {
                                //lblError.Text += "<b>" + xmlReader.Name + ":</b>" + xmlReader.Value + "<br />";
                            }
                            break;
                        case XmlNodeType.Text:
                            //lblError.Text += "<b>" + xmlReader.LocalName + ":</b>" + xmlReader.Value + "<br />";
                            break;
                    }
                }
                xmlReader.Close();

                clsTransferOut.CommitAndDispose();
                LoadRecord();
                LoadItems();
            }
            else
            {
                string stScript = "<Script>";
                stScript += "window.alert('Please select Transfer In file to upload.')";
                stScript += "</Script>";
                Response.Write(stScript);
            }
        }
Exemplo n.º 20
0
		public Int64 Insert(ProductDetails Details)
		{
			try  
			{
                if (IsExist(Details.ProductID, Details.BarCode, Details.BarCode2, Details.BarCode3))
                {
                    throw new EntryPointNotFoundException("This product already exist, please check the barcode.");
                }

				string SQL =	"INSERT INTO tblProducts (" +
									"ProductCode, " + 
									"ProductDesc, " +  
									"ProductSubGroupID, " + 
									"BaseUnitID, " + 
									"DateCreated, " +
									"PercentageCommision, " +
									"IncludeInSubtotalDiscount, " +
									"MinThreshold, " +
									"MaxThreshold, " +
									"SupplierID, " +
									"IsItemSold, " +
									"WillPrintProductComposition"+
								") VALUES (" +
									"@ProductCode, " + 
									"@ProductDesc, " +   
									"@ProductSubGroupID, " + 
									"@BaseUnitID, " + 
									"@DateCreated," + 
									"@PercentageCommision, " +
									"@IncludeInSubtotalDiscount, " +
									"@MinThreshold, " +
									"@MaxThreshold, " +
									"@SupplierID, " +
									"@IsItemSold, " +
									"@WillPrintProductComposition);"; 

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				MySqlParameter prmProductCode = new MySqlParameter("@ProductCode",MySqlDbType.String);			
				prmProductCode.Value = Details.ProductCode;
				cmd.Parameters.Add(prmProductCode);

				MySqlParameter prmProductDesc = new MySqlParameter("@ProductDesc",MySqlDbType.String);			
				prmProductDesc.Value = Details.ProductDesc;
				cmd.Parameters.Add(prmProductDesc);

				MySqlParameter prmProductSubGroupID = new MySqlParameter("@ProductSubGroupID",MySqlDbType.Int64);			
				prmProductSubGroupID.Value = Details.ProductSubGroupID;
				cmd.Parameters.Add(prmProductSubGroupID);

				MySqlParameter prmBaseUnitID = new MySqlParameter("@BaseUnitID",MySqlDbType.String);			
				prmBaseUnitID.Value = Details.BaseUnitID;
				cmd.Parameters.Add(prmBaseUnitID);

				MySqlParameter prmDateCreated = new MySqlParameter("@DateCreated",MySqlDbType.DateTime);			
				prmDateCreated.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
				cmd.Parameters.Add(prmDateCreated);

				MySqlParameter prmPercentageCommision = new MySqlParameter("@PercentageCommision",MySqlDbType.Decimal);			
				prmPercentageCommision.Value = Details.PercentageCommision;
				cmd.Parameters.Add(prmPercentageCommision);

				MySqlParameter prmIncludeInSubtotalDiscount = new MySqlParameter("@IncludeInSubtotalDiscount",MySqlDbType.Int16);			
				prmIncludeInSubtotalDiscount.Value = Details.IncludeInSubtotalDiscount;
				cmd.Parameters.Add(prmIncludeInSubtotalDiscount);

				MySqlParameter prmMinThreshold = new MySqlParameter("@MinThreshold",MySqlDbType.Decimal);			
				prmMinThreshold.Value = Details.MinThreshold;
				cmd.Parameters.Add(prmMinThreshold);

				MySqlParameter prmMaxThreshold = new MySqlParameter("@MaxThreshold",MySqlDbType.Decimal);			
				prmMaxThreshold.Value = Details.MaxThreshold;
				cmd.Parameters.Add(prmMaxThreshold);

				MySqlParameter prmSupplierID = new MySqlParameter("@SupplierID",MySqlDbType.Int64);			
				prmSupplierID.Value = Details.SupplierID;
				cmd.Parameters.Add(prmSupplierID);

				MySqlParameter prmIsItemSold = new MySqlParameter("@IsItemSold",MySqlDbType.Int16);
				prmIsItemSold.Value = Convert.ToInt16(Details.IsItemSold);
				cmd.Parameters.Add(prmIsItemSold);

				MySqlParameter prmWillPrintProductComposition = new MySqlParameter("@WillPrintProductComposition",MySqlDbType.Int16);
				prmWillPrintProductComposition.Value = Convert.ToInt16(Details.WillPrintProductComposition);
				cmd.Parameters.Add(prmWillPrintProductComposition);

				base.ExecuteNonQuery(cmd);

				SQL = "SELECT LAST_INSERT_ID();";
				
				cmd.Parameters.Clear(); 
				cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);
                

                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

				ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails();
				clsProductPackageDetails.ProductID = iID;
				clsProductPackageDetails.BarCode1 = Details.BarCode;
				clsProductPackageDetails.BarCode2 = Details.BarCode2;
				clsProductPackageDetails.BarCode3 = Details.BarCode3;
				clsProductPackageDetails.UnitID = Details.BaseUnitID;
				clsProductPackageDetails.Price = Details.Price;
                clsProductPackageDetails.Price1 = Details.Price1;
                clsProductPackageDetails.Price2 = Details.Price2;
                clsProductPackageDetails.Price3 = Details.Price3;
                clsProductPackageDetails.Price4 = Details.Price4;
                clsProductPackageDetails.Price5 = Details.Price5;
				clsProductPackageDetails.WSPrice = Details.WSPrice;
                clsProductPackageDetails.PurchasePrice = Details.PurchasePrice;
                clsProductPackageDetails.Quantity = 1;
				clsProductPackageDetails.VAT = Details.VAT;
				clsProductPackageDetails.EVAT = Details.EVAT;
				clsProductPackageDetails.LocalTax = Details.LocalTax;

				ProductPackage clsProductPackage = new ProductPackage(base.Connection, base.Transaction);
				clsProductPackage.Insert(clsProductPackageDetails);

				// Oct 28, 2011 : Lemu
				// Added to cater branch inventory
                //BranchInventory clsBranchInventory = new BranchInventory(base.Connection, base.Transaction);
                //clsBranchInventory.CreateToAllBranches(iID);

				//base.ExecuteNonQuery(cmd);
				
				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemplo n.º 21
0
		private void Upload()
		{
			if( ( txtPath.PostedFile != null ) && ( txtPath.PostedFile.ContentLength > 0 ) )
			{
				string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);
				string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;

				txtPath.PostedFile.SaveAs(SaveLocation);
				XmlTextReader reader = new XmlTextReader(SaveLocation);
				reader.WhitespaceHandling = WhitespaceHandling.None;

				Stock clsStock = new Stock();
				clsStock.GetConnection();

				string strStockTransactionNo = null;
				long StockID = 0;
				long ContactID = 0;
				int UnitID = 0;
				long ProductGroupID = 0;
				long ProductSubGroupID = 0;
				long ProductID = 0;
				long ProductBaseMatrixID = 0;

				VariationDetails clsVariationDetails;
				int VariationID = 0;

				StockItemDetails clsStockItemDetails = new StockItemDetails();

				while (reader.Read()) 
				{
					switch (reader.NodeType) 
					{
						case XmlNodeType.Element:
							if (reader.Name == "Stock") 
							{
								strStockTransactionNo = reader.GetAttribute("TransactionNo");

								StockID = clsStock.Details(reader.GetAttribute("TransactionNo")).StockID;
								if (StockID > 0)
								{
									clsStock.CommitAndDispose();
									Label1.Text = "<b>This file has already been added to inventory.<br />";
									Label1.Text += "Please refer to transaction No: " + strStockTransactionNo + ".</b>";
									reader.Close();
									return;
								}
								Contacts clsContact = new Contacts(clsStock.Connection, clsStock.Transaction);
								ContactID = clsContact.Details(reader.GetAttribute("ContactCode")).ContactID;
								if (ContactID == 0)
								{
									ContactDetails clsContactDetails = new ContactDetails();
									clsContactDetails.ContactCode = reader.GetAttribute("ContactCode");
									clsContactDetails.ContactName = reader.GetAttribute("ContactName");
									clsContactDetails.ContactGroupID = Convert.ToInt32(reader.GetAttribute("ContactGroupID"));
                                    clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), reader.GetAttribute("ModeOfTerms"));
									clsContactDetails.Terms = Convert.ToInt32(reader.GetAttribute("Terms"));
									clsContactDetails.Address = reader.GetAttribute("Address");
									clsContactDetails.BusinessName = reader.GetAttribute("BusinessName");
									clsContactDetails.TelephoneNo = reader.GetAttribute("TelephoneNo");
									clsContactDetails.Remarks = reader.GetAttribute("Remarks");
									clsContactDetails.Debit = Convert.ToDecimal(reader.GetAttribute("Debit"));
									clsContactDetails.Credit = Convert.ToDecimal(reader.GetAttribute("Credit"));
									clsContactDetails.IsCreditAllowed = Convert.ToBoolean(reader.GetAttribute("IsCreditAllowed"));
									clsContactDetails.CreditLimit = Convert.ToDecimal(reader.GetAttribute("CreditLimit"));
									ContactID = clsContact.Insert(clsContactDetails);
								}

                                StockDetails clsStockDetails = new StockDetails();
								clsStockDetails.TransactionNo = reader.GetAttribute("TransactionNo");
								clsStockDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID);
								clsStockDetails.StockDate = DateTime.Now;
								clsStockDetails.SupplierID = ContactID;
								clsStockDetails.Remarks = reader.GetAttribute("StockRemarks") + Environment.NewLine + "Original Stock Date: " + reader.GetAttribute("StockDate");
								
								StockItemDetails[] itemDetails = new StockItemDetails[0];
								clsStockDetails.StockItems = itemDetails;

								StockID = clsStock.Insert(clsStockDetails);
							}
							else if (reader.Name == "Item") 
							{
								Data.Unit clsUnit = new Data.Unit(clsStock.Connection, clsStock.Transaction);
								UnitID = clsUnit.Details(reader.GetAttribute("ProductUnitCode")).UnitID;
								if (UnitID == 0) 
								{
									UnitDetails clsUnitDetails = new UnitDetails();
									clsUnitDetails.UnitCode = reader.GetAttribute("ProductUnitCode");
									clsUnitDetails.UnitName = reader.GetAttribute("ProductUnitName");
									UnitID = clsUnit.Insert(clsUnitDetails);
								}

								ProductGroup clsProductGroup = new ProductGroup(clsStock.Connection, clsStock.Transaction);
								ProductGroupID = clsProductGroup.Details(reader.GetAttribute("ProductGroupCode")).ProductGroupID;
								if (ProductGroupID == 0) 
								{
									Label1.Text += "inserting product group....";
									ProductGroupDetails clsProductGroupDetails = new ProductGroupDetails();
									clsProductGroupDetails.ProductGroupCode = reader.GetAttribute("ProductGroupCode");
									clsProductGroupDetails.ProductGroupName = reader.GetAttribute("ProductGroupName");
                                    clsProductGroupDetails.UnitDetails = new UnitDetails
                                    {
                                        UnitID = UnitID
                                    };
									clsProductGroupDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price"));
									clsProductGroupDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice"));
									clsProductGroupDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount"));
									clsProductGroupDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT"));
									clsProductGroupDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT"));
									clsProductGroupDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax"));
									ProductGroupID = clsProductGroup.Insert(clsProductGroupDetails);
								}
								
								ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsStock.Connection, clsStock.Transaction);
								ProductSubGroupID = clsProductSubGroup.Details(reader.GetAttribute("ProductSubGroupCode")).ProductSubGroupID;
								if (ProductSubGroupID == 0) 
								{
									Label1.Text += "inserting product sub-group....";
									ProductSubGroupDetails clsProductSubGroupDetails = new ProductSubGroupDetails();
									clsProductSubGroupDetails.ProductGroupID = ProductGroupID;
									clsProductSubGroupDetails.ProductSubGroupCode = reader.GetAttribute("ProductSubGroupCode");
									clsProductSubGroupDetails.ProductSubGroupName = reader.GetAttribute("ProductSubGroupName");
									clsProductSubGroupDetails.BaseUnitID = UnitID;
									clsProductSubGroupDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price"));
									clsProductSubGroupDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice"));
									clsProductSubGroupDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount"));
									clsProductSubGroupDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT"));
									clsProductSubGroupDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT"));
									clsProductSubGroupDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax"));
									ProductSubGroupID = clsProductSubGroup.Insert(clsProductSubGroupDetails);
								}

								Products clsProduct = new Products(clsStock.Connection, clsStock.Transaction);
                                ProductID = clsProduct.Details(reader.GetAttribute("BarCode")).ProductID;
								if (ProductID == 0) 
								{
									Label1.Text += "inserting product....";
									ProductDetails clsProductDetails = new ProductDetails();
									clsProductDetails.ProductCode  = reader.GetAttribute("ProductCode");
									clsProductDetails.BarCode  = reader.GetAttribute("BarCode");
									clsProductDetails.ProductDesc = reader.GetAttribute("ProductDesc");
									clsProductDetails.ProductGroupID = ProductGroupID; 
									clsProductDetails.ProductSubGroupID  = ProductSubGroupID;
									clsProductDetails.ProductDesc  = reader.GetAttribute("ProductDesc");
									clsProductDetails.BaseUnitID = UnitID;
									clsProductDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price")); 
									clsProductDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice")); 
									clsProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount")); 
									clsProductDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT")); 
									clsProductDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT")); 
									clsProductDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax")); 
									clsProductDetails.Quantity = 0;
									clsProductDetails.MinThreshold = Convert.ToDecimal(reader.GetAttribute("MinThreshold"));
									clsProductDetails.MaxThreshold = Convert.ToDecimal(reader.GetAttribute("MaxThreshold"));
									clsProductDetails.SupplierID = Contacts.DEFAULT_SUPPLIER_ID;
									ProductID = clsProduct.Insert(clsProductDetails);
								}

                                //ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsStock.Connection, clsStock.Transaction);
                                //ProductBaseMatrixID = clsProductVariationsMatrix.BaseDetails(0, 0, ProductID, reader["ItemBaseVariationDescription"].ToString()).MatrixID;
                                //if (ProductBaseMatrixID == 0)
                                //{
                                //    ProductBaseMatrixDetails clsBaseDetails = new ProductBaseMatrixDetails();
                                //    clsBaseDetails.ProductID = ProductID;
                                //    clsBaseDetails.Description = reader.GetAttribute("ItemBaseVariationDescription");
                                //    clsBaseDetails.UnitID = UnitID;
                                //    clsBaseDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price"));
                                //    clsBaseDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice"));
                                //    clsBaseDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount"));
                                //    clsBaseDetails.Quantity = 0;
                                //    clsBaseDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT"));
                                //    clsBaseDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT"));
                                //    clsBaseDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax"));
                                //    clsBaseDetails.MinThreshold = Convert.ToDecimal(reader.GetAttribute("MinThreshold"));
                                //    clsBaseDetails.MaxThreshold = Convert.ToDecimal(reader.GetAttribute("MaxThreshold"));
                                //    ProductBaseMatrixID = clsProductVariationsMatrix.InsertBaseVariation(clsBaseDetails);
                                //    clsBaseDetails.MatrixID = ProductBaseMatrixID;
                                //}

								clsStockItemDetails = new StockItemDetails();
								clsStockItemDetails.StockID = StockID;
								clsStockItemDetails.ProductID = ProductID;
								clsStockItemDetails.VariationMatrixID = ProductBaseMatrixID;
								clsStockItemDetails.ProductUnitID = UnitID;
								clsStockItemDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID);
								clsStockItemDetails.StockDate = DateTime.Now;
								clsStockItemDetails.Quantity = Convert.ToDecimal(reader.GetAttribute("ItemQuantity"));
								clsStockItemDetails.Remarks = reader.GetAttribute("ItemRemarks");

                                Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"];
                                clsStock.AddItem(Constants.BRANCH_ID_MAIN, strStockTransactionNo, clsAccessUserDetails.Name, clsStockItemDetails, StockDirections.Increment);
							}
							else if (reader.Name == "Variation" && reader.GetAttribute("VariationCode") != null)
							{
								Variation clsVariation = new Variation(clsStock.Connection, clsStock.Transaction);
								VariationID = clsVariation.Details(reader.GetAttribute("VariationCode")).VariationID;
								if (VariationID == 0 ) 
								{	
									clsVariationDetails = new VariationDetails();
									clsVariationDetails.VariationCode = reader.GetAttribute("VariationCode");
									clsVariationDetails.VariationType = reader.GetAttribute("VariationType");
									VariationID = clsVariation.Insert(clsVariationDetails);
								}

								ProductVariationDetails clsProductVariationDetails = new ProductVariationDetails();
								clsProductVariationDetails.ProductID = ProductID;
								clsProductVariationDetails.VariationID = VariationID;

								ProductVariations clsProductVariation = new ProductVariations(clsStock.Connection, clsStock.Transaction);
								if (clsProductVariation.isExist(clsProductVariationDetails) == false)
								{
									long ProductVariationID = clsProductVariation.Insert(clsProductVariationDetails);
								}

							}
							else if (reader.Name == "VariationMatrix" && reader.GetAttribute("VariationCode") != null)
							{
								Variation clsVariation = new Variation(clsStock.Connection, clsStock.Transaction);
								VariationID = clsVariation.Details(reader.GetAttribute("VariationCode")).VariationID;
								if (VariationID == 0) 
								{
									clsVariationDetails = new VariationDetails();
									clsVariationDetails.VariationCode = reader.GetAttribute("VariationCode");
									clsVariationDetails.VariationType = reader.GetAttribute("VariationType");
									VariationID = clsVariation.Insert(clsVariationDetails);
								}

								ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsStock.Connection, clsStock.Transaction);
								if (clsProductVariationsMatrix.isExist(ProductBaseMatrixID, VariationID) == false)
								{
									ProductVariationsMatrixDetails clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails();
                                    clsProductVariationsMatrixDetails.ProductID = ProductID;
                                    clsProductVariationsMatrixDetails.MatrixID = ProductBaseMatrixID;
									clsProductVariationsMatrixDetails.VariationID = VariationID;
									clsProductVariationsMatrixDetails.Description = reader.GetAttribute("Description");
									clsProductVariationsMatrix.SaveVariation(clsProductVariationsMatrixDetails);
								}
							}
							else
							{
								Label1.Text = "<b>Reader Name:<b>" + reader.Name + "<br />";
							}
							break;
						case XmlNodeType.Text:
							Label1.Text = "<b>" + reader.LocalName + ":<b>" + reader.Value + "<br />";
							break;
					}       
				}
				reader.Close();
				
				clsStock.CommitAndDispose();
				Label1.Text = "<b>Transaction No.: " + strStockTransactionNo + " has been successfully transferred.<br />";
			}
			else
			{
				Response.Write("Please select a file to upload.");
			}

		}
Exemplo n.º 22
0
		public void Update(ProductDetails Details)
		{
			try 
			{
                if (IsExist(Details.ProductID, Details.BarCode, Details.BarCode2, Details.BarCode3))
                {
                    throw new Exception("This product already exist, please check the barcode.");
                }

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

				string SQL =	"UPDATE tblProducts SET " +
									"ProductCode		= @ProductCode, " + 
									"ProductDesc		= @ProductDesc, " +  
									"ProductSubGroupID	= @ProductSubGroupID, " + 
									"BaseUnitID			= @BaseUnitID, " +
									"PercentageCommision        =   @PercentageCommision, " +
									"IncludeInSubtotalDiscount	=	@IncludeInSubtotalDiscount, " +
									"MinThreshold		= @MinThreshold, " +
									"MaxThreshold		= @MaxThreshold, " +
									"SupplierID			= @SupplierID, " +
									"IsItemSold			= @IsItemSold, " +
									"WillPrintProductComposition    =   @WillPrintProductComposition, " +
                                    "RID                = @RID, " +
                                    "SequenceNo         = @SequenceNo " +
								"WHERE ProductID	    = @ProductID;";
				  
                cmd.Parameters.AddWithValue("ProductCode", Details.ProductCode);
                cmd.Parameters.AddWithValue("ProductDesc", Details.ProductDesc);
                cmd.Parameters.AddWithValue("ProductSubGroupID", Details.ProductSubGroupID);
                cmd.Parameters.AddWithValue("BaseUnitID", Details.BaseUnitID);
                cmd.Parameters.AddWithValue("PercentageCommision", Details.PercentageCommision);
                cmd.Parameters.AddWithValue("IncludeInSubtotalDiscount", Details.IncludeInSubtotalDiscount);
                cmd.Parameters.AddWithValue("MinThreshold", Details.MinThreshold);
                cmd.Parameters.AddWithValue("MaxThreshold", Details.MaxThreshold);
                cmd.Parameters.AddWithValue("SupplierID", Details.SupplierID);
                cmd.Parameters.AddWithValue("IsItemSold", Details.IsItemSold);
                cmd.Parameters.AddWithValue("WillPrintProductComposition", Details.WillPrintProductComposition);
                cmd.Parameters.AddWithValue("RID", Details.RID);
                cmd.Parameters.AddWithValue("SequenceNo", Details.SequenceNo);
                cmd.Parameters.AddWithValue("ProductID", Details.ProductID);

                cmd.CommandText = SQL;
				base.ExecuteNonQuery(cmd);

                if (Details.Quantity > 0)
                {
                    SQL = "UPDATE tblProducts SET Active = 1 WHERE ProductID = @ProductID AND Active = 0;";

                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("ProductID", Details.ProductID);

                    cmd.CommandText = SQL;
                    base.ExecuteNonQuery(cmd);
                }
				ProductPackageDetails clsDetails = new ProductPackageDetails();
				clsDetails.ProductID = Details.ProductID;
				clsDetails.Quantity = 1;
				clsDetails.Price = Details.Price;
                clsDetails.Price1 = Details.Price1;
                clsDetails.Price2 = Details.Price2;
                clsDetails.Price3 = Details.Price3;
                clsDetails.Price4 = Details.Price4;
                clsDetails.Price5 = Details.Price5;
				clsDetails.WSPrice = Details.WSPrice;
                clsDetails.PurchasePrice = Details.PurchasePrice;
				clsDetails.VAT = Details.VAT;
				clsDetails.EVAT = Details.EVAT;
				clsDetails.LocalTax = Details.LocalTax;
				clsDetails.UnitID = Details.BaseUnitID;
				clsDetails.UnitCode = Details.BaseUnitCode;
				clsDetails.UnitName = Details.BaseUnitName;
				clsDetails.BarCode1 = Details.BarCode;
				clsDetails.BarCode2 = Details.BarCode2;
				clsDetails.BarCode3 = Details.BarCode3;

				ProductPackage clsProductPackage = new ProductPackage(base.Connection, base.Transaction);
				clsProductPackage.UpdateByProductIDUnitIDAndQuantity(clsDetails, Details.UpdatedBy, Details.UpdatedOn, "Edit product module.");
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Exemplo n.º 23
0
		private void LoadOptions()
		{
			Int64 prodid = Convert.ToInt64(Common.Decrypt(Request.QueryString["prodid"].ToString(),Session.SessionID));
			lblProductID.Text = Convert.ToString(prodid);
			
			ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix();
			ProductUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(prodid);

			if (clsUnitDetails.BottomUnitName == null)
			{
				Products clsProduct = new Products();
				ProductDetails clsDetails = new ProductDetails();
                clsDetails = clsProduct.Details(prodid);
				clsProduct.CommitAndDispose();

				txtBaseUnit.Text = clsDetails.BaseUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsDetails.BaseUnitID);
			}
			else
			{
				txtBaseUnit.Text = clsUnitDetails.BottomUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID);
			}

			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsUnitMatrix.AvailableUnitsForProduct(prodid).DefaultView;
			cboBottomUnit.DataBind();
			if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text)))
			{
				cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text)));
			}
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1;

			clsUnitMatrix.CommitAndDispose();
		}
Exemplo n.º 24
0
		private void SaveRecord()
		{
			ProductDetails clsDetails = new ProductDetails();

			clsDetails.ProductID = Convert.ToInt64(lblProductID.Text);
			clsDetails.ProductCode  = txtProductCode.Text;
			clsDetails.BarCode  = txtBarcode.Text;
			clsDetails.ProductDesc = txtProductDesc.Text;
			clsDetails.ProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); 
			clsDetails.ProductSubGroupID  = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value);
			clsDetails.ProductDesc  = txtProductDesc.Text;
			clsDetails.BaseUnitID  = Convert.ToInt32(cboProductUnit.SelectedItem.Value); 
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
			clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked;
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);
			clsDetails.MinThreshold = Convert.ToDecimal(txtMinThreshold.Text);
			clsDetails.MaxThreshold = Convert.ToDecimal(txtMaxThreshold.Text);
			clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value); 

			Products clsProduct = new Products();
			clsProduct.Update(clsDetails);
			clsProduct.CommitAndDispose();
		}