Exemple #1
0
        private void SetDataSource(ReportDocument Report)
        {
            long iID = 0;

            try
            {
                if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["poid"].ToString() != null)
                {
                    iID = Convert.ToInt64(Request.QueryString["poid"].ToString());
                }
                else
                {
                    iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["poid"].ToString(), Session.SessionID));
                }
                lblReferrer.ToolTip = iID.ToString();
            }
            catch { iID = long.Parse(lblReferrer.ToolTip); }

            ReportDataset rptds = new ReportDataset();

            PO clsPO = new PO();

            System.Data.DataTable dt = clsPO.ListAsDataTable(POID: iID);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.PO.NewRow();

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

                rptds.PO.Rows.Add(drNew);
            }

            POItem clsPOItem = new POItem(clsPO.Connection, clsPO.Transaction);

            dt = clsPOItem.ListAsDataTable(iID);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.POItems.NewRow();

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

                rptds.POItems.Rows.Add(drNew);
            }
            clsPO.CommitAndDispose();

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }
Exemple #2
0
        private void CancelPO()
        {
            long   POID    = Convert.ToInt64(lblPOID.Text);
            string Remarks = txtRemarks.Text;

            PO clsPO = new PO();

            clsPO.Cancel(POID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString()));
            clsPO.CommitAndDispose();

            BackToPOList();
        }
Exemple #3
0
        protected void chkIncludeIneSales_CheckedChanged(Object sender, EventArgs e)
        {
            CheckBox     chkIncludeIneSales = (CheckBox)sender;
            DataListItem item = (DataListItem)chkIncludeIneSales.NamingContainer;

            HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList");
            Int64             iPOID   = Int64.Parse(chkList.Value);

            PO clsPO = new PO();

            clsPO.UpdateIncludeIneSales(iPOID, chkIncludeIneSales.Checked);
            clsPO.CommitAndDispose();
        }
Exemple #4
0
        private Int64 SaveRecord()
        {
            PO clsPO = new PO();

            clsPO.GetConnection();
            lblPONo.Text = Constants.PURCHASE_ORDER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsPO.LastTransactionNo();

            PODetails clsDetails = new PODetails();

            clsDetails.PONo                = lblPONo.Text;
            clsDetails.PODate              = Convert.ToDateTime(lblPODate.Text);
            clsDetails.SupplierID          = Convert.ToInt64(cboSupplier.SelectedItem.Value);
            clsDetails.SupplierCode        = cboSupplier.SelectedItem.Text;
            clsDetails.SupplierContact     = txtSupplierContact.Text;
            clsDetails.SupplierAddress     = txtSupplierAddress.Text;
            clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text;
            clsDetails.SupplierTerms       = Convert.ToInt32(lblTerms.Text);
            clsDetails.SupplierTINNo       = txtSupplierTINNo.Text;
            clsDetails.SupplierLTONo       = txtSupplierLTONo.Text;
            switch (lblModeOfterms.Text)
            {
            case "Days":
                clsDetails.SupplierModeOfTerms = 0;
                break;

            case "Months":
                clsDetails.SupplierModeOfTerms = 1;
                break;

            case "Years":
                clsDetails.SupplierModeOfTerms = 2;
                break;
            }
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.RID           = Convert.ToInt64(txtRID.Text);
            clsDetails.BranchID      = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.PurchaserID   = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.PurchaserName = Session["Name"].ToString();
            clsDetails.Status        = POStatus.Open;
            clsDetails.Remarks       = txtRemarks.Text;

            bool boIsePurchaseOrder = bool.TryParse(lblIsePurchaseOrder.Text, out boIsePurchaseOrder) ? boIsePurchaseOrder : false;

            clsDetails.IncludeIneSales = boIsePurchaseOrder;

            Int64 id = clsPO.Insert(clsDetails);

            clsPO.CommitAndDispose();

            return(id);
        }
Exemple #5
0
        private void SaveRecord()
        {
            PODetails clsDetails = new PODetails();

            clsDetails.POID                = Convert.ToInt64(lblPOID.Text);
            clsDetails.PONo                = lblPONo.Text;
            clsDetails.PODate              = Convert.ToDateTime(lblPODate.Text);
            clsDetails.SupplierID          = Convert.ToInt64(cboSupplier.SelectedItem.Value);
            clsDetails.SupplierCode        = cboSupplier.SelectedItem.Text;
            clsDetails.SupplierContact     = txtSupplierContact.Text;
            clsDetails.SupplierAddress     = txtSupplierAddress.Text;
            clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text;
            clsDetails.SupplierTINNo       = txtSupplierTINNo.Text;
            clsDetails.SupplierLTONo       = txtSupplierLTONo.Text;
            switch (lblModeOfterms.Text)
            {
            case "Days":
                clsDetails.SupplierModeOfTerms = 0;
                break;

            case "Months":
                clsDetails.SupplierModeOfTerms = 1;
                break;

            case "Years":
                clsDetails.SupplierModeOfTerms = 2;
                break;
            }
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.RID           = Convert.ToInt64(txtRID.Text);
            clsDetails.BranchID      = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.PurchaserID   = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.PurchaserName = Session["Name"].ToString();
            clsDetails.Status        = POStatus.Open;
            clsDetails.Remarks       = txtRemarks.Text;

            PO clsPO = new PO();

            clsPO.Update(clsDetails);
            clsPO.CommitAndDispose();
        }
Exemple #6
0
        protected void cboPayee_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            long payeeid = Convert.ToInt64(cboPayee.SelectedItem.Value);

            Data.Contacts       clsContact = new Data.Contacts();
            Data.ContactDetails clsDetails = clsContact.Details(payeeid);
            clsContact.CommitAndDispose();

            txtPayeeName.Text = clsDetails.ContactName;

            DataClass clsDataClass = new DataClass();

            PO clsPO = new PO();

            lstPO.DataSource = clsDataClass.DataReaderToDataTable(clsPO.ListForPayment(payeeid, "POID", SortOption.Ascending)).DefaultView;
            lstPO.DataBind();
            clsPO.CommitAndDispose();

            Label lblAmount;
            Label lblPaidAmount;
            Label lblUnpaidAmount;

            decimal decAmount       = 0;
            decimal decPaidAmount   = 0;
            decimal decUnpaidAmount = 0;

            foreach (DataListItem item in lstPO.Items)
            {
                lblAmount       = (Label)item.FindControl("lblAmount");
                lblPaidAmount   = (Label)item.FindControl("lblPaidAmount");
                lblUnpaidAmount = (Label)item.FindControl("lblUnpaidAmount");

                decAmount       += Convert.ToDecimal(lblAmount.Text);
                decPaidAmount   += Convert.ToDecimal(lblPaidAmount.Text);
                decUnpaidAmount += Convert.ToDecimal(lblUnpaidAmount.Text);
            }

            lblPOTotalAmount.Text       = decAmount.ToString("#,##0.#0");
            lblPOTotalPaidAmount.Text   = decPaidAmount.ToString("#,##0.#0");
            lblPOTotalUnpaidAmount.Text = decUnpaidAmount.ToString("#,##0.#0");
        }
Exemple #7
0
        protected void chkIncludeIneSalesAll_CheckedChanged(Object sender, EventArgs e)
        {
            HtmlInputCheckBox chkList = null;
            CheckBox          chkIncludeIneSalesAll = (CheckBox)sender;
            CheckBox          chkIncludeIneSales    = null;
            Int64             iPOID = 0;

            PO clsPO = new PO();

            foreach (DataListItem item in lstItem.Items)
            {
                chkList = (HtmlInputCheckBox)item.FindControl("chkList");

                iPOID = Int64.Parse(chkList.Value);

                chkIncludeIneSales = (CheckBox)item.FindControl("chkIncludeIneSales");

                clsPO.UpdateIncludeIneSales(iPOID, chkIncludeIneSalesAll.Checked);
                chkIncludeIneSales.Checked = chkIncludeIneSalesAll.Checked;
            }
            clsPO.CommitAndDispose();
        }
Exemple #8
0
        private void LoadRecord()
        {
            Int64     iID        = Convert.ToInt64(Common.Decrypt(Request.QueryString["poid"], Session.SessionID));
            PO        clsPO      = new PO();
            PODetails clsDetails = clsPO.Details(iID);

            clsPO.CommitAndDispose();

            lblPOID.Text   = clsDetails.POID.ToString();
            lblPONo.Text   = clsDetails.PONo;
            lblPODate.Text = clsDetails.PODate.ToString("yyyy-MM-dd HH:mm:ss");
            txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            txtRID.Text = clsDetails.RID.ToString();
            cboSupplier.SelectedIndex   = cboSupplier.Items.IndexOf(cboSupplier.Items.FindByValue(clsDetails.SupplierID.ToString()));
            txtSupplierContact.Text     = clsDetails.SupplierContact;
            txtSupplierTelephoneNo.Text = clsDetails.SupplierTelephoneNo;
            txtSupplierTINNo.Text       = clsDetails.SupplierTINNo;
            txtSupplierLTONo.Text       = clsDetails.SupplierLTONo;
            lblTerms.Text = clsDetails.SupplierTerms.ToString("##0");
            switch (clsDetails.SupplierModeOfTerms)
            {
            case 0:
                lblModeOfterms.Text = "Days";
                break;

            case 1:
                lblModeOfterms.Text = "Months";
                break;

            case 2:
                lblModeOfterms.Text = "Years";
                break;
            }
            txtSupplierAddress.Text = clsDetails.SupplierAddress;
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString()));
            txtBranchAddress.Text   = clsDetails.BranchAddress;
            txtRemarks.Text         = clsDetails.Remarks;
        }
Exemple #9
0
        private void SavePO()
        {
            bool   boRetValuePO = false;
            string stIDs        = "";

            foreach (DataListItem item in lstPO.Items)
            {
                HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList");
                if (chkList != null)
                {
                    if (chkList.Checked == true)
                    {
                        stIDs       += chkList.Value + ",";
                        boRetValuePO = true;
                    }
                }
            }
            if (boRetValuePO)
            {
                PO clsPO = new PO();
                clsPO.UpdatePaymentStatus(POPaymentStatus.ForProcessing, stIDs.Substring(0, stIDs.Length - 1));
                clsPO.CommitAndDispose();
            }
        }
Exemple #10
0
        private void LoadList()
        {
            PO        clsPO        = new PO();
            DataClass clsDataClass = new DataClass();
            Common    Common       = new Common();

            string SortField = "POID";

            if (Request.QueryString["sortfield"] != null)
            {
                SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);
            }

            SortOption sortoption = SortOption.Desscending;

            if (Request.QueryString["sortoption"] != null)
            {
                sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);
            }

            DateTime dteOrderStartDate = DateTime.MinValue;

            try { if (txtOrderStartDate.Text != string.Empty)
                  {
                      dteOrderStartDate = Convert.ToDateTime(txtOrderStartDate.Text + " " + txtOrderStartTime.Text);
                  }
            }
            catch { }

            DateTime dteOrderEndDate = DateTime.MinValue;

            try { if (txtOrderEndDate.Text != string.Empty)
                  {
                      dteOrderEndDate = Convert.ToDateTime(txtOrderEndDate.Text + " " + txtOrderEndTime.Text);
                  }
            }
            catch { }

            DateTime dtePostingStartDate = DateTime.MinValue;

            try { if (txtPostingStartDate.Text != string.Empty)
                  {
                      dtePostingStartDate = Convert.ToDateTime(txtPostingStartDate.Text + " " + txtPostingStartTime.Text);
                  }
            }
            catch { }

            DateTime dtePostingEndDate = DateTime.MinValue;

            try { if (txtPostingEndDate.Text != string.Empty)
                  {
                      dtePostingEndDate = Convert.ToDateTime(txtPostingEndDate.Text + " " + txtPostingEndTime.Text);
                  }
            }
            catch { }

            eSalesFilter clseSalesFilter = new eSalesFilter();

            clseSalesFilter.FilterIncludeIneSales = true;
            clseSalesFilter.IncludeIneSales       = false;

            string   SearchKey = txtSearch.Text;
            POStatus status    = (POStatus)Enum.Parse(typeof(POStatus), cboStatus.SelectedItem.Value);

            PageData.DataSource = clsPO.SearchAsDataTable(status, dteOrderStartDate, dteOrderEndDate, dtePostingStartDate, dtePostingEndDate, SearchKey, SortField, sortoption, 0, clseSalesFilter).DefaultView;

            clsPO.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;
        }
Exemple #11
0
        private void LoadRecord()
        {
            Int64     iID        = Convert.ToInt64(Common.Decrypt(Request.QueryString["poid"], Session.SessionID));
            PO        clsPO      = new PO();
            PODetails clsDetails = clsPO.Details(iID);

            clsPO.CommitAndDispose();

            lblPOID.Text = clsDetails.POID.ToString();
            lblPONo.Text = clsDetails.PONo;
            ///lblPONo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&poid=" + Common.Encrypt(clsDetails.POID.ToString(), Session.SessionID);

            lblPODate.Text = clsDetails.PODate.ToString("yyyy-MM-dd HH:mm:ss");
            lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            lblSupplierID.Text           = clsDetails.SupplierID.ToString();

            lblSupplierCode.Text = clsDetails.SupplierCode.ToString();
            string stParam = "?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.SupplierID.ToString(), Session.SessionID);

            lblSupplierCode.NavigateUrl = "../_Vendor/Default.aspx" + stParam;

            lblSupplierContact.Text     = clsDetails.SupplierContact;
            lblSupplierTelephoneNo.Text = clsDetails.SupplierTelephoneNo;
            lblTerms.Text = clsDetails.SupplierTerms.ToString("##0");
            switch (clsDetails.SupplierModeOfTerms)
            {
            case 0:
                lblModeOfterms.Text = "Days";
                break;

            case 1:
                lblModeOfterms.Text = "Months";
                break;

            case 2:
                lblModeOfterms.Text = "Years";
                break;
            }
            lblSupplierAddress.Text = clsDetails.SupplierAddress;
            lblBranchID.Text        = clsDetails.BranchID.ToString();
            lblBranchCode.Text      = clsDetails.BranchCode;
            lblBranchAddress.Text   = clsDetails.BranchAddress;
            lblPORemarks.Text       = clsDetails.Remarks;

            txtPODiscountApplied.Text       = clsDetails.DiscountApplied.ToString("###0.#0");
            cboPODiscountType.SelectedIndex = cboPODiscountType.Items.IndexOf(cboPODiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d")));
            lblPODiscount.Text     = clsDetails.Discount.ToString("#,##0.#0");
            lblTotalDiscount1.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount + clsDetails.Discount2 + clsDetails.Discount3).ToString("#,##0.#0");

            txtPODiscount2Applied.Text       = clsDetails.Discount2Applied.ToString("###0.#0");
            cboPODiscount2Type.SelectedIndex = cboPODiscount2Type.Items.IndexOf(cboPODiscount2Type.Items.FindByValue(clsDetails.Discount2Type.ToString("d")));
            lblPODiscount2.Text    = clsDetails.Discount2.ToString("#,##0.#0");
            lblTotalDiscount2.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount2 + clsDetails.Discount3).ToString("#,##0.#0");

            txtPODiscount3Applied.Text       = clsDetails.Discount3Applied.ToString("###0.#0");
            cboPODiscount3Type.SelectedIndex = cboPODiscount3Type.Items.IndexOf(cboPODiscountType.Items.FindByValue(clsDetails.Discount3Type.ToString("d")));
            lblPODiscount3.Text    = clsDetails.Discount3.ToString("#,##0.#0");
            lblTotalDiscount3.Text = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.Discount3).ToString("#,##0.#0");

            lblPOVatableAmount.Text   = clsDetails.VatableAmount.ToString("#,##0.#0");
            txtPOFreight.Text         = clsDetails.Freight.ToString("#,##0.#0");
            txtPODeposit.Text         = clsDetails.Deposit.ToString("#,##0.#0");
            lblPOVAT.Text             = clsDetails.VAT.ToString("#,##0.#0");
            chkIsVatInclusive.Checked = clsDetails.IsVatInclusive;
            if (clsDetails.IsVatInclusive)
            {
                lblPOSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0");
                lblPOTotal.Text    = clsDetails.SubTotal.ToString("#,##0.#0");
            }
            else
            {
                lblPOSubTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0");
                lblPOTotal.Text    = Convert.ToDecimal(clsDetails.SubTotal + clsDetails.VAT).ToString("#,##0.#0");
            }
        }
Exemple #12
0
        private void ExportPO2File()
        {
            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);

            //Contact clsContact = new Contact(clsStock.Connection, clsStock.Transaction);
            //ContactDetails clsPODetails = clsContact.Details(clsPODetails.SupplierID);

            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******/
            writer.WriteAttributeString("SupplierID", XmlConvert.ToString(clsPODetails.SupplierID));
            writer.WriteAttributeString("SupplierCode", clsPODetails.SupplierCode);
            writer.WriteAttributeString("SupplierContact", clsPODetails.SupplierContact);
            writer.WriteAttributeString("SupplierAddress", clsPODetails.SupplierAddress);
            writer.WriteAttributeString("SupplierTelephoneNo", clsPODetails.SupplierTelephoneNo);
            writer.WriteAttributeString("SupplierModeOfTerms", XmlConvert.ToString(clsPODetails.SupplierModeOfTerms));
            writer.WriteAttributeString("SupplierTerms", XmlConvert.ToString(clsPODetails.SupplierTerms));
            /******End Of Supplier Information******/

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

            /******Branch & Purchaser Information******/
            writer.WriteAttributeString("BranchID", XmlConvert.ToString(clsPODetails.BranchID));
            writer.WriteAttributeString("BranchCode", clsPODetails.BranchCode);
            writer.WriteAttributeString("BranchName", clsPODetails.BranchName);
            writer.WriteAttributeString("BranchAddress", clsPODetails.BranchAddress);
            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("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());
                writer.WriteAttributeString("IsItemSold", clsProductDetails.IsItemSold.ToString());
                writer.WriteAttributeString("Active", clsProductDetails.Active.ToString());
                writer.WriteAttributeString("PercentageCommision", clsProductDetails.PercentageCommision.ToString());
                /*****End Of Product Information*****/

                writer.WriteAttributeString("ItemVariationMatrixID", row["VariationMatrixID"].ToString());
                writer.WriteAttributeString("ItemBaseVariationDescription", row["MatrixDescription"].ToString());
                writer.WriteAttributeString("ItemProductUnitID", row["ProductUnitID"].ToString());
                writer.WriteAttributeString("ItemUnitCode", row["ProductUnitCode"].ToString());
                writer.WriteAttributeString("isVATInclusive", row["isVATInclusive"].ToString());
                writer.WriteAttributeString("POItemStatus", row["POItemStatus"].ToString());
                writer.WriteAttributeString("IsVatable", row["IsVatable"].ToString());
                writer.WriteAttributeString("SellingPrice", row["SellingPrice"].ToString());
                writer.WriteAttributeString("SellingVAT", row["SellingVAT"].ToString());
                writer.WriteAttributeString("SellingEVAT", row["SellingEVAT"].ToString());
                writer.WriteAttributeString("SellingLocalTax", row["SellingLocalTax"].ToString());
                writer.WriteAttributeString("OldSellingPrice", row["OldSellingPrice"].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);
        }