Esempio n. 1
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;
        }
Esempio n. 2
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;
        }
Esempio n. 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;
        }
Esempio n. 4
0
        private void ExportToFile()
        {
            TransferOut        clsTransferOut        = new TransferOut();
            TransferOutDetails clsTransferOutDetails = clsTransferOut.Details(long.Parse(lblTransferOutID.Text));

            TransferOutItem clsTransferOutItem  = new TransferOutItem(clsTransferOut.Connection, clsTransferOut.Transaction);
            DataTable       dtaTransferOutItems = clsTransferOutItem.ListAsDataTable(clsTransferOutDetails.TransferOutID, null, SortOption.Ascending);

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

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

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

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

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

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

            writer.Formatting = Formatting.Indented;
            writer.WriteStartDocument();
            writer.WriteComment("This file represents the TransferOut Details of TransferOut No: '" + clsTransferOutDetails.TransferOutNo + "' 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("TransferOutDetails");
            writer.WriteAttributeString("TransferOutID", XmlConvert.ToString(clsTransferOutDetails.TransferOutID));
            writer.WriteAttributeString("TransferOutNo", clsTransferOutDetails.TransferOutNo);
            writer.WriteAttributeString("TransferOutDate", clsTransferOutDetails.TransferOutDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Supplier information******/
            clsContactDetails = clsContact.Details(clsTransferOutDetails.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", clsTransferOutDetails.SupplierAddress);
            writer.WriteAttributeString("SupplierTelephoneNo", clsTransferOutDetails.SupplierTelephoneNo);
            writer.WriteAttributeString("SupplierModeOfTerms", XmlConvert.ToString(clsTransferOutDetails.SupplierModeOfTerms));
            writer.WriteAttributeString("SupplierTerms", XmlConvert.ToString(clsTransferOutDetails.SupplierTerms));
            writer.WriteAttributeString("SupplierContactGroupName", clsContactDetails.ContactGroupName);
            /******End Of Supplier Information******/

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

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

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

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

                writer.WriteStartElement("TransferOutItem");
                writer.WriteAttributeString("TransferOutItemID", row["TransferOutItemID"].ToString());
                writer.WriteAttributeString("TransferOutID", row["TransferOutID"].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("ItemTransferOutItemStatus", row["TransferOutItemStatus"].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();

            clsTransferOut.CommitAndDispose();

            string stScript = "<Script>";

            stScript += "window.open('/RetailPlus/temp/" + lblBranchCode.Text.Replace(" ", "").Trim() + "_" + clsTransferOutDetails.TransferOutNo + "_" + clsTransferOutDetails.TransferOutDate.ToString("yyyyMMddHHmmssffff") + ".xml')";
            stScript += "</Script>";
            Response.Write(stScript);
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
        private void Transfer()
        {
            Int64        iID             = Convert.ToInt64(Common.Decrypt(Request.QueryString["stockid"], Session.SessionID));
            Stock        clsStock        = new Stock();
            StockDetails clsStockDetails = clsStock.Details(iID);

            StockItem clsStockItem     = new StockItem(clsStock.Connection, clsStock.Transaction);
            DataTable dtaStockItemList = clsStockItem.ListAsDataTable(Convert.ToInt64(lblStockID.Text));

            Contacts       clsContact        = new Contacts(clsStock.Connection, clsStock.Transaction);
            ContactDetails clsContactDetails = clsContact.Details(clsStockDetails.SupplierID);

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

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

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

            string        xmlFileName = Server.MapPath(@"\RetailPlus\temp\" + cboBranch.SelectedItem.Text.Replace(" ", "").Trim() + clsStockDetails.TransactionNo + ".xml");
            XmlTextWriter writer      = new XmlTextWriter(xmlFileName, System.Text.Encoding.UTF8);

            writer.Formatting = Formatting.Indented;
            writer.WriteStartDocument();
            writer.WriteComment("This file represents a new stock transaction for branch: '" + cboBranch.SelectedItem.Text + "'.");
            writer.WriteComment("Save this in your local file. Goto 'File', click 'Save As', select the location in your local directory, click 'Save'.");
            writer.WriteStartElement("Stock");
            writer.WriteAttributeString("StockID", XmlConvert.ToString(clsStockDetails.StockID));
            writer.WriteAttributeString("TransactionNo", clsStockDetails.TransactionNo);
            writer.WriteAttributeString("StockTypeID", XmlConvert.ToString(clsStockDetails.StockTypeID));
            writer.WriteAttributeString("StockTypeCode", clsStockDetails.StockTypeCode);
            writer.WriteAttributeString("StockTypeDescription", clsStockDetails.StockTypeDescription);
            writer.WriteAttributeString("StockDirection", clsStockDetails.StockDirection.ToString());
            writer.WriteAttributeString("StockDate", clsStockDetails.StockDate.ToString("MM/dd/yyyy HH:mm:ss"));

            /******Supplier information******/
            writer.WriteAttributeString("ContactID", XmlConvert.ToString(clsContactDetails.ContactID));
            writer.WriteAttributeString("ContactCode", clsContactDetails.ContactCode);
            writer.WriteAttributeString("ContactName", clsContactDetails.ContactName);
            writer.WriteAttributeString("ContactGroupID", clsContactDetails.ContactGroupID.ToString());
            writer.WriteAttributeString("ContactGroupName", clsContactDetails.ContactGroupName);
            writer.WriteAttributeString("ModeOfTerms", clsContactDetails.ModeOfTerms.ToString());
            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", clsContactDetails.Debit.ToString());
            writer.WriteAttributeString("Credit", clsContactDetails.Credit.ToString());
            writer.WriteAttributeString("CreditLimit", clsContactDetails.CreditLimit.ToString());
            writer.WriteAttributeString("IsCreditAllowed", clsContactDetails.IsCreditAllowed.ToString());
            writer.WriteAttributeString("DateCreated", clsContactDetails.DateCreated.ToString("MM/dd/yy HH:mm:ss"));
            writer.WriteAttributeString("Deleted", clsContactDetails.Deleted.ToString());
            /******End Of Supplier Information******/

            writer.WriteAttributeString("StockRemarks", clsStockDetails.Remarks);
            foreach (DataRow row in dtaStockItemList.Rows)
            {
                clsProductDetails = new ProductDetails();
                clsProductDetails = clsProduct.Details(Convert.ToInt64(row["ProductID"].ToString()));

                writer.WriteStartElement("Item");
                writer.WriteAttributeString("ItemStockItemID", row["StockItemID"].ToString());
                writer.WriteAttributeString("ItemStockID", row["StockID"].ToString());
                writer.WriteAttributeString("ItemProductID", row["ProductID"].ToString());

                /*****Product Information*****/
                writer.WriteAttributeString("ProductCode", clsProductDetails.ProductCode);
                writer.WriteAttributeString("BarCode", clsProductDetails.BarCode);
                writer.WriteAttributeString("ProductDesc", clsProductDetails.ProductDesc);
                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("ProductUnitCode", clsProductDetails.BaseUnitCode);
                writer.WriteAttributeString("ProductUnitName", 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());
                /*****End Of Product Information*****/

                writer.WriteAttributeString("ItemVariationMatrixID", row["VariationMatrixID"].ToString());
                writer.WriteAttributeString("ItemBaseVariationDescription", row["BaseVariationDescription"].ToString());
                writer.WriteAttributeString("ItemProductUnitID", row["ProductUnitID"].ToString());
                writer.WriteAttributeString("ItemUnitCode", row["UnitCode"].ToString());
                writer.WriteAttributeString("ItemUnitName", row["UnitName"].ToString());
                writer.WriteAttributeString("ItemStockTypeID", row["StockTypeID"].ToString());
                writer.WriteAttributeString("ItemStockTypeDescription", row["StockTypeDescription"].ToString());
                writer.WriteAttributeString("ItemStockDate", row["StockDate"].ToString());
                writer.WriteAttributeString("ItemQuantity", row["Quantity"].ToString());
                writer.WriteAttributeString("ItemRemarks", row["Remarks"].ToString());

                dtaProductVariation = clsProductVariation.ListAsDataTable(clsProductDetails.ProductID, "a.VariationID", 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(Convert.ToInt64(row["VariationMatrixID"].ToString()), "MatrixID", 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();

            clsStock.CommitAndDispose();

            string stScript = "<Script>";

            stScript += "window.open('/RetailPlus/temp/" + cboBranch.SelectedItem.Text.Replace(" ", "").Trim() + clsStockDetails.TransactionNo + ".xml')";
            stScript += "</Script>";
            Response.Write(stScript);
        }