Пример #1
0
		private void LoadOptions()
		{
			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);
			lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductVariations clsProductVariation = new ProductVariations();
			lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			lstItem.DataBind();

			ProductUnitsMatrix clsUnit = new ProductUnitsMatrix(clsProductVariation.Connection, clsProductVariation.Transaction);
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();

			Products clsProduct = new Products(clsProductVariation.Connection, clsProductVariation.Transaction);
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
			cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
			clsProductVariation.CommitAndDispose();

			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
		}
Пример #2
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);
        }
Пример #3
0
		private void LoadOptions()
		{
			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);

			ProductVariations clsProductVariation = new ProductVariations();
			lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			lstItem.DataBind();
			clsProductVariation.CommitAndDispose();
			
			ProductUnitsMatrix clsUnit = new ProductUnitsMatrix();
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();	

			Products clsProduct = new Products();
            ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
            lblProductSubGroupID.Text = clsProductDetails.ProductSubGroupID.ToString();

			cboUnit.Items.Add(new ListItem(clsProductDetails.BaseUnitName, clsProductDetails.BaseUnitID.ToString()));
			cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsProductDetails.Price.ToString("#,##0.#0");
            txtPrice1.Text = clsProductDetails.Price1.ToString("#,##0.#0");
            txtPrice2.Text = clsProductDetails.Price2.ToString("#,##0.#0");
            txtPrice3.Text = clsProductDetails.Price3.ToString("#,##0.#0");
            txtPrice4.Text = clsProductDetails.Price4.ToString("#,##0.#0");
            txtPrice5.Text = clsProductDetails.Price5.ToString("#,##0.#0");
            txtWSPrice.Text = clsProductDetails.WSPrice.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsProductDetails.PurchasePrice.ToString("#,##0.#0");
            decimal decMargin = clsProductDetails.Price - clsProductDetails.PurchasePrice;
            try { decMargin = decMargin / clsProductDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtMargin.Text = decMargin.ToString("#,##0.##0");

            decMargin = clsProductDetails.WSPrice - clsProductDetails.PurchasePrice;
            try { decMargin = decMargin / clsProductDetails.PurchasePrice; }
            catch { decMargin = 1; }
            decMargin = decMargin * 100;
            txtWSPriceMarkUp.Text = decMargin.ToString("#,##0.##0");

            chkIncludeInSubtotalDiscount.Checked = clsProductDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsProductDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsProductDetails.EVAT.ToString("#,##0.#0");
			clsProduct.CommitAndDispose();

            string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID);
            lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam;

		}
Пример #4
0
		private void LoadList()
		{	
			ProductVariations clsProductVariation = new ProductVariations();
			DataClass clsDataClass = new DataClass();

			string SortField = "a.VariationID";
			if (Request.QueryString["sortfield"]!=null)
			{	SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);	}
			
			SortOption sortoption = SortOption.Ascending;
			if (Request.QueryString["sortoption"]!=null)
			{	sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);	}

			if (Request.QueryString["Search"]==null)
			{
				PageData.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text), SortField, sortoption == SortOption.Ascending ? System.Data.SqlClient.SortOrder.Ascending : System.Data.SqlClient.SortOrder.Descending).DefaultView;
			}
			else
			{	
				string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
				PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductVariation.Search(Convert.ToInt64(lblProductID.Text),SearchKey, SortField, sortoption)).DefaultView;
			}

			clsProductVariation.CommitAndDispose();

			int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
			
			PageData.AllowPaging = true;
			PageData.PageSize = iPageSize;
			try
			{
				PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;				
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}
			catch
			{
				PageData.CurrentPageIndex = 1;
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}			
			
			cboCurrentPage.Items.Clear();
			for (int i=0; i < PageData.PageCount;i++)
			{
				int iValue = i + 1;
				cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
				if (PageData.CurrentPageIndex == i)
				{	cboCurrentPage.Items[i].Selected = true;}
				else
				{	cboCurrentPage.Items[i].Selected = false;}
			}
			lblDataCount.Text = " of " + " " + PageData.PageCount;
		}
Пример #5
0
        private void Download()
        {
            DateTime dteProcessingDate = DateTime.Now;

            Products clsProduct = new Products();
            ProductDetails[] arrProductDetails = clsProduct.List();

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

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

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

            try{
                lblError.Text += "Creating xml file...<br /><br />";
                string xmlFileName = Server.MapPath(@"\RetailPlus\temp\ExportedProductList_" + CompanyDetails.BECompanyCode + "_" + dteProcessingDate.ToString("yyyyMMddHHmm") + ".xml");
                XmlTextWriter writer = new XmlTextWriter(xmlFileName, System.Text.Encoding.UTF8);
                
                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument();
                writer.WriteComment("This file represents the latest list of " + CompanyDetails.CompanyName + " products as of '" + dteProcessingDate.ToString("yyyyMMddHHmm")  + "'.");
                writer.WriteComment("Save this in your local file. Goto 'File', click 'Save As', select the location in your local directory, click 'Save'.");
                writer.WriteStartElement("Products");
                lblError.Text += "Creating Products...<br /><br />";
                foreach(ProductDetails clsProductDetails in arrProductDetails)
                {
                    writer.WriteStartElement("Item");
                    lblError.Text += "Writing " + clsProductDetails.ProductCode + "...";
                    writer.WriteAttributeString("ProductID", XmlConvert.ToString(clsProductDetails.ProductID));
                    writer.WriteAttributeString("ProductCode", clsProductDetails.ProductCode);
                    writer.WriteAttributeString("BarCode", clsProductDetails.BarCode);
                    writer.WriteAttributeString("ProductDesc", clsProductDetails.ProductDesc);
                    writer.WriteAttributeString("ProductGroupID", XmlConvert.ToString(clsProductDetails.ProductGroupID));
                    writer.WriteAttributeString("ProductGroupCode", clsProductDetails.ProductGroupCode);
                    writer.WriteAttributeString("ProductGroupName", clsProductDetails.ProductGroupName);
                    writer.WriteAttributeString("ProductSubGroupID", XmlConvert.ToString(clsProductDetails.ProductSubGroupID));
                    writer.WriteAttributeString("ProductSubGroupCode", clsProductDetails.ProductSubGroupCode);
                    writer.WriteAttributeString("ProductSubGroupName", clsProductDetails.ProductSubGroupName);
                    writer.WriteAttributeString("BaseUnitID", XmlConvert.ToString(clsProductDetails.BaseUnitID));
                    writer.WriteAttributeString("BaseUnitCode", clsProductDetails.BaseUnitCode);
                    writer.WriteAttributeString("BaseUnitName", clsProductDetails.BaseUnitName);
                    writer.WriteAttributeString("DateCreated", clsProductDetails.DateCreated.ToString("MM/dd/yyyy HH:mm:ss"));
                    writer.WriteAttributeString("Deleted",  XmlConvert.ToString(clsProductDetails.Deleted));
                    writer.WriteAttributeString("Price", XmlConvert.ToString(clsProductDetails.Price));
                    writer.WriteAttributeString("PurchasePrice", XmlConvert.ToString(clsProductDetails.PurchasePrice));
                    writer.WriteAttributeString("IncludeInSubtotalDiscount", XmlConvert.ToString(clsProductDetails.IncludeInSubtotalDiscount));
                    writer.WriteAttributeString("VAT", XmlConvert.ToString(clsProductDetails.VAT));
                    writer.WriteAttributeString("EVAT", XmlConvert.ToString(clsProductDetails.EVAT));
                    writer.WriteAttributeString("LocalTax", XmlConvert.ToString(clsProductDetails.LocalTax));
                    writer.WriteAttributeString("Quantity", XmlConvert.ToString(clsProductDetails.Quantity));
                    writer.WriteAttributeString("MinThreshold", XmlConvert.ToString(clsProductDetails.MinThreshold));
                    writer.WriteAttributeString("MaxThreshold", XmlConvert.ToString(clsProductDetails.MaxThreshold));

                    //Get the SUpplier Details
                    clsContactDetails = clsContact.Details(clsProductDetails.SupplierID);

                    writer.WriteAttributeString("ContactID", XmlConvert.ToString(clsContactDetails.ContactID));
                    writer.WriteAttributeString("ContactCode", clsContactDetails.ContactCode);
                    writer.WriteAttributeString("ContactName", clsContactDetails.ContactName);
                    
                    clsContactGroupDetails = clsContactGroup.Details(clsContactDetails.ContactGroupID);
                    writer.WriteAttributeString("ContactGroupCode", clsContactGroupDetails.ContactGroupCode);
                    writer.WriteAttributeString("ContactGroupCategory", clsContactGroupDetails.ContactGroupCategory.ToString("G"));
                    writer.WriteAttributeString("ContactGroupName", clsContactDetails.ContactGroupName);

                    writer.WriteAttributeString("ModeOfTerms", clsContactDetails.ModeOfTerms.ToString("G"));
                    writer.WriteAttributeString("Terms", clsContactDetails.Terms.ToString());
                    writer.WriteAttributeString("Address", clsContactDetails.Address);
                    writer.WriteAttributeString("BusinessName", clsContactDetails.BusinessName);
                    writer.WriteAttributeString("TelephoneNo", clsContactDetails.TelephoneNo);
                    writer.WriteAttributeString("Remarks", clsContactDetails.Remarks);
                    writer.WriteAttributeString("Debit", "0");
                    writer.WriteAttributeString("Credit", "0");
                    writer.WriteAttributeString("CreditLimit", clsContactDetails.CreditLimit.ToString());
                    writer.WriteAttributeString("IsCreditAllowed", clsContactDetails.IsCreditAllowed.ToString());
                    writer.WriteAttributeString("ContactDateCreated", clsContactDetails.DateCreated.ToString("MM/dd/yyyy HH:mm:ss"));

                    writer.WriteAttributeString("ChartOfAccountIDPurchase", XmlConvert.ToString(clsProductDetails.ChartOfAccountIDPurchase));
                    writer.WriteAttributeString("ChartOfAccountIDSold", XmlConvert.ToString(clsProductDetails.ChartOfAccountIDSold));
                    writer.WriteAttributeString("ChartOfAccountIDInventory", XmlConvert.ToString(clsProductDetails.ChartOfAccountIDInventory));
                    writer.WriteAttributeString("ChartOfAccountIDTaxPurchase", XmlConvert.ToString(clsProductDetails.ChartOfAccountIDTaxPurchase));
                    writer.WriteAttributeString("ChartOfAccountIDTaxSold", XmlConvert.ToString(clsProductDetails.ChartOfAccountIDTaxSold));
                    writer.WriteAttributeString("IsItemSold", XmlConvert.ToString(clsProductDetails.IsItemSold));
                    writer.WriteAttributeString("WillPrintProductComposition", XmlConvert.ToString(clsProductDetails.WillPrintProductComposition));
                    writer.WriteAttributeString("UpdatedBy", XmlConvert.ToString(clsProductDetails.UpdatedBy));
                    writer.WriteAttributeString("UpdatedOn", clsProductDetails.UpdatedOn.ToString("MM/dd/yyyy HH:mm:ss"));
                    writer.WriteAttributeString("PercentageCommision", XmlConvert.ToString(clsProductDetails.PercentageCommision));
                    writer.WriteAttributeString("QuantityIN", XmlConvert.ToString(clsProductDetails.QuantityIN));
                    writer.WriteAttributeString("QuantityOUT", XmlConvert.ToString(clsProductDetails.QuantityOUT));

                    //Get Variations
                    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();
                    }

                    writer.WriteEndElement();
                    lblError.Text += " Done.<br /><br />";
                }
                writer.WriteEndElement();

                //Write the XML to file and close the writer
                writer.Flush();
                writer.Close();
                lblError.Text += "Done creating XML file. <br /><br />";
                //lblError.Text = "/RetailPlus/temp/ExportedProductList_" + CompanyDetails.BECompanyCode + "_" + dteProcessingDate.ToString("yyyyMMddHHmm") + ".xml<br /><br />" + lblError.Text;
                clsProduct.CommitAndDispose();

                string stScript = "<Script>";
                stScript += "window.open('../../temp/ExportedProductList_" + CompanyDetails.BECompanyCode + "_" + dteProcessingDate.ToString("yyyyMMddHHmm") + ".xml');";
                stScript += "</Script>";
                Response.Write(stScript);
            }
            catch (Exception ex)
            {
                lblError.Text += "ERROR WHILE CREATING xml FILE: " + ex.Message;
            }
        }
Пример #6
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblProductID.Text = Common.Decrypt((string)Request.QueryString["prodid"],Session.SessionID);
			lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductVariations clsProductVariation = new ProductVariations();
			lstItem.DataSource = clsProductVariation.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			lstItem.DataBind();
			clsProductVariation.CommitAndDispose();	

			ProductUnitsMatrix clsProductUnitsMatrix = new ProductUnitsMatrix();
			cboUnit.DataTextField = "BottomUnitName";
			cboUnit.DataValueField = "BottomUnitID";
			cboUnit.DataSource = clsProductUnitsMatrix.ListAsDataTable(Convert.ToInt64(lblProductID.Text)).DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsProductUnitsMatrix.CommitAndDispose();	

			Products clsProduct = new Products();
            ProductDetails clsDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));
			cboUnit.Items.Add(new ListItem(clsDetails.BaseUnitName, clsDetails.BaseUnitID.ToString()));
			clsProduct.CommitAndDispose();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;

            lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString();

            string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(lblProductID.Text, Session.SessionID);
            lnkVariations.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_Variations/Default.aspx" + stParam;

		}