protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
				if (Visible)
				{
                    Branch clsBranch = new Branch();
                    cboBranch.DataTextField = "BranchCode";
                    cboBranch.DataValueField = "BranchID";
                    cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
                    cboBranch.DataBind();
                    
                    cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

                    mlngItemNo = 0;

                    ProductGroup clsProductGroup = new ProductGroup(clsBranch.Connection, clsBranch.Transaction);
                    cboProductGroup.DataTextField = "ProductGroupName";
                    cboProductGroup.DataValueField = "ProductGroupID";
                    cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroup.Text).DefaultView;
                    cboProductGroup.DataBind();
                    cboProductGroup.SelectedIndex = 0;

                    clsBranch.CommitAndDispose();

					LoadList();
				}
        }
		private void LoadOptions()
		{
            try
            {
                Branch clsBranch = new Branch();
                cboBranch.DataTextField = "BranchCode";
                cboBranch.DataValueField = "BranchID";
                cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
                cboBranch.DataBind();
                clsBranch.CommitAndDispose();
                if (cboBranch.Items.Count == 0) cboBranch.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING));
                cboBranch.SelectedIndex = 0;
                
                if (Request.QueryString["task"] != null && Request.QueryString["tranno"] != null)
                {
                    if (Request.QueryString["task"].ToString().ToLower() == "transaction")
                    {
                        txtTransactionNo.Text = Request.QueryString["tranno"].ToString();
                        if (Request.QueryString["termno"] != null)
                        {
                            txtTerminalNo.Text = Request.QueryString["termno"].ToString();
                        }
                        if (Request.QueryString["branchid"] != null)
                        {
                            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Request.QueryString["branchid"].ToString()));
                        }
                        GenerateHTML();
                    }
                }
            }
            catch { }
		}
        protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
				if (Visible)
				{
                    Branch clsBranch = new Branch();
                    cboBranch.DataTextField = "BranchCode";
                    cboBranch.DataValueField = "BranchID";
                    cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
                    cboBranch.DataBind();
                    
                    cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

                    mlngItemNo = 0;

                    ProductGroup clsProductGroup = new ProductGroup(clsBranch.Connection, clsBranch.Transaction);
                    cboProductGroup.DataTextField = "ProductGroupName";
                    cboProductGroup.DataValueField = "ProductGroupID";
                    cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroup.Text).DefaultView;
                    cboProductGroup.DataBind();
                    cboProductGroup.SelectedIndex = 0;

                    clsBranch.CommitAndDispose();

                    txtClosingDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
					ManageSecurity();
					LoadList();
                    cmdZeroOutActualQuantity.Attributes.Add("onClick", "return confirm_zeroout_inventory();");
                    imgZeroOutActualQuantity.Attributes.Add("onClick", "return confirm_zeroout_inventory();");
                    cmdCopyPOSToActual.Attributes.Add("onClick", "return confirm_copypostoactual_inventory();");
                    imgCopyPOSToActual.Attributes.Add("onClick", "return confirm_copypostoactual_inventory();");
                    //cmdCloseInventory.Attributes.Add("onClick", "return confirm_close_inventory();");
                    //imgCloseInventory.Attributes.Add("onClick", "return confirm_close_inventory();");
				}
        }
Beispiel #4
0
		private void LoadOptions()
		{
            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.CREDITS_Purchases, ReportTypes.CREDITS_Purchases));
            cboReportType.Items.Add(new ListItem(ReportTypes.CREDITS_Payments, ReportTypes.CREDITS_Payments));
            cboReportType.Items.Add(new ListItem(ReportTypes.CREDITS_CreditorsLedgerSummary, ReportTypes.CREDITS_CreditorsLedgerSummary));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.CustomerCreditSummarizedStatistics, ReportTypes.CustomerCreditSummarizedStatistics));
            cboReportType.SelectedIndex = 0;

            if (Request.QueryString["reporttype"] != null)
            {
                lblReportType.Text = Common.Decrypt(Request.QueryString["reporttype"].ToString(), Session.SessionID);

                switch (lblReportType.Text.ToLower())
                {
                    case "purchases": cboReportType.SelectedIndex = cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.CREDITS_Purchases)); break;
                    case "payments": cboReportType.SelectedIndex = cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.CREDITS_Payments)); break;
                    case "ledger": cboReportType.SelectedIndex = cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.CREDITS_CreditorsLedgerSummary)); break;
                    case "stat": cboReportType.SelectedIndex = cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.CustomerCreditSummarizedStatistics)); break;
                    default:
                        break;
                }
            }

            Data.CardType clsCardType = new Data.CardType();
            cboCreditType.Items.Clear();
            cboCreditType.DataTextField = "CardTypeCode";
            cboCreditType.DataValueField = "CardTypeID";
            cboCreditType.DataSource = clsCardType.ListAsDataTable(new CardTypeDetails(CreditCardTypes.Internal, false)).DefaultView;
            cboCreditType.DataBind();
            cboCreditType.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboCreditType.SelectedIndex = cboCreditType.Items.Count >= 2 ? 1 : 0;


            Branch clsBranch = new Branch(clsCardType.Connection, clsCardType.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Billing clsBilling = new Billing(clsCardType.Connection, clsCardType.Transaction);
            cboBillingDate.DataTextField = "BillingDate";
            cboBillingDate.DataValueField = "BillingDate";
            cboBillingDate.DataSource = clsBilling.ListBillingDateAsDataTable(CreditType.Individual, CreditCardTypeID: Int16.Parse(cboCreditType.SelectedItem.Value)).DefaultView;
            cboBillingDate.DataBind();
            cboBillingDate.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.C_DATE_MIN_VALUE_STRING));
            cboBillingDate.SelectedIndex = cboBillingDate.Items.Count >= 2 ? 1 : 0;

            clsCardType.CommitAndDispose();

            txtTrxStartDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
            txtTrxEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

            cboReportType_SelectedIndexChanged(null, null);
        }
		private void LoadOptions()
		{
            txtStartDate.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
            txtEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));

            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.ProductList, ReportTypes.ProductList));

            if (clsAccessRights.Details(UID, (int)AccessTypes.PricesReport).Read)
            { cboReportType.Items.Add(new ListItem(ReportTypes.ProductPriceList, ReportTypes.ProductPriceList)); }
            
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.ProductListWithInvalidMatrix, ReportTypes.ProductListWithInvalidMatrix));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.WeightedProductsForWeighingScale, ReportTypes.WeightedProductsForWeighingScale));
            cboReportType.Items.Add(new ListItem(ReportTypes.CountedProductsForWeighingScale, ReportTypes.CountedProductsForWeighingScale));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));

            if (clsAccessRights.Details(UID, (int)AccessTypes.ProductsInDemoReport).Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.ProductsInDemoReport, ReportTypes.ProductsInDemoReport));

            clsAccessRights.CommitAndDispose();
            cboReportType.SelectedIndex = 0;
            

            Branch clsBranch = new Branch();
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Contacts clsContact = new Contacts(clsBranch.Connection, clsBranch.Transaction);
            cboContact.DataTextField = "ContactName";
            cboContact.DataValueField = "ContactID";
            cboContact.DataSource = clsContact.SuppliersAsDataTable(txtContactCode.Text, 100).DefaultView;
            cboContact.DataBind();
            cboContact.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboContact.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsBranch.Connection, clsBranch.Transaction);
            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupID";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(txtProductGroupCode.Text, "ProductGroupName").DefaultView;
            cboProductGroup.DataBind();
            cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductGroup.SelectedIndex = 0;

            clsBranch.CommitAndDispose();

            cboProductGroup_SelectedIndexChanged(null, System.EventArgs.Empty);
		}
Beispiel #6
0
		private void LoadRecord()
		{
			Int16 iID = Convert.ToInt16(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			Branch clsBranch = new Branch();
			BranchDetails clsDetails = clsBranch.Details(iID);
			clsBranch.CommitAndDispose();

			lblBranchID.Text = Convert.ToString(clsDetails.BranchID);
			txtBranchCode.Text = clsDetails.BranchCode;
			txtBranchName.Text = clsDetails.BranchName;
			txtDBIP.Text = clsDetails.DBIP;
			txtDBPort.Text = clsDetails.DBPort;
			txtAddress.Text = clsDetails.Address;
			txtRemarks.Text = clsDetails.Remarks;
            chkIncludeIneSales.Checked = clsDetails.IncludeIneSales;
		}
        private void LoadOptions()
        {
            Branch clsBranch = new Branch();
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.SelectedIndex = 0;
            clsBranch.CommitAndDispose();

            if (cboBranch.Items.Count == 0)
            {
                imgSynchronize.Visible = false;
                cmdSynchronize.Enabled = false;
                cboBranch.Items.Add(new ListItem("No Branch", "0"));
            }
        }
Beispiel #8
0
		private void LoadOptions()
		{
            Branch clsBranch = new Branch();
            cboBranchFrom.DataTextField = "BranchCode";
            cboBranchFrom.DataValueField = "BranchID";
            cboBranchFrom.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranchFrom.DataBind();

            cboBranchTo.DataTextField = "BranchCode";
            cboBranchTo.DataValueField = "BranchID";
            cboBranchTo.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranchTo.DataBind();

            clsBranch.CommitAndDispose();

            try { cboBranchFrom.SelectedIndex = 0; }
            catch { }
            try { cboBranchTo.SelectedIndex = cboBranchTo.Items.Count - 1; }
            catch { }
		}
Beispiel #9
0
        private void LoadOptions()
        {
            DataClass clsDataClass = new DataClass();

            Contacts clsContact = new Contacts();
            cboCustomer.DataTextField = "ContactName";
            cboCustomer.DataValueField = "ContactID";
            cboCustomer.DataSource = clsContact.CustomersDataTable(null).DefaultView;
            cboCustomer.DataBind();
            clsContact.CommitAndDispose();
            cboCustomer.SelectedIndex = 0;
            cboCustomer_SelectedIndexChanged(null, null);

            Branch clsBranch = new Branch();
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            clsBranch.CommitAndDispose();
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));
            cboBranch_SelectedIndexChanged(null, null);
        }
Beispiel #10
0
		private void LoadList()
		{	
			Branch clsBranch = new Branch();
			DataClass clsDataClass = new DataClass();

			string SortField = "BranchID";
			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);	}

            string SearchKey = "";
			if (Request.QueryString["Search"]!=null)
			{
				SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
			}
            PageData.DataSource = clsBranch.ListAsDataTable(SearchKey, SortField, sortoption, 0).DefaultView;
			clsBranch.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;
		}
		private void LoadOptions()
		{
            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();
            Security.AccessRightsDetails clsDetails = clsAccessRights.Details(UID,(int) AccessTypes.SummarizedDailySalesWithTFDetailed);
            clsAccessRights.CommitAndDispose();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));
            cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales));

            if (clsDetails.Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay));

            if (cboReportType.Items.Count == 2) cboReportType.Items.RemoveAt(cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.REPORT_SELECTION)));
			cboReportType.SelectedIndex = 0;

            cboConsignment.Items.Clear();
            cboConsignment.Items.Add(new ListItem("Both", "-1"));
            cboConsignment.Items.Add(new ListItem("Yes", true.ToString()));
            cboConsignment.Items.Add(new ListItem("No", false.ToString()));

			cboTransactionStatus.Items.Clear();
			foreach(string status in Enum.GetNames(typeof(TransactionStatus)))
			{
				cboTransactionStatus.Items.Add(new ListItem(status, status));
			}
			cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString()));

			cboPaymentType.Items.Clear();
			foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes)))
			{
				cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType));
			}
			cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString()));

			txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1));
            txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now);

            Customer clsCustomer = new Customer();
            cboContactName.DataTextField = "ContactName";
            cboContactName.DataValueField = "ContactID";
            cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending);
            cboContactName.DataBind();
            if (string.IsNullOrEmpty(txtContactName.Text))
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING));
            cboContactName.SelectedIndex = 0;

            cboAgent.Items.Clear();
            Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction);
            cboAgent.DataTextField = "ContactName";
            cboAgent.DataValueField = "ContactID";
            cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending);
            cboAgent.DataBind();
            if (string.IsNullOrEmpty(txtAgent.Text))
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING));
            cboAgent.SelectedIndex = 0;

            Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction);
            cboTerminalNo.DataTextField = "TerminalNo";
            cboTerminalNo.DataValueField = "TerminalNo";
            cboTerminalNo.DataSource = clsTerminal.ListAsDataTable();
            cboTerminalNo.DataBind();
            cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL));
            cboTerminalNo.SelectedIndex = 0;

            Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable(OnlyIncludeIneSales: true).DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction);
            cboCashierName.DataTextField = "Name";
            cboCashierName.DataValueField = "UID";
            cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0);
            cboCashierName.DataBind();
            if (string.IsNullOrEmpty(txtCashierName.Text))
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING));
            cboCashierName.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction);
            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupName";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName");
            cboProductGroup.DataBind();
            cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductGroup.SelectedIndex = 0;
            clsCustomer.CommitAndDispose();

            #region Sales Per Day
            cboMonth.Items.Add(new ListItem("January", "1"));
            cboMonth.Items.Add(new ListItem("February", "2"));
            cboMonth.Items.Add(new ListItem("March", "3"));
            cboMonth.Items.Add(new ListItem("April", "4"));
            cboMonth.Items.Add(new ListItem("May", "5"));
            cboMonth.Items.Add(new ListItem("June", "6"));
            cboMonth.Items.Add(new ListItem("July", "7"));
            cboMonth.Items.Add(new ListItem("August", "8"));
            cboMonth.Items.Add(new ListItem("September", "9"));
            cboMonth.Items.Add(new ListItem("October", "10"));
            cboMonth.Items.Add(new ListItem("November", "11"));
            cboMonth.Items.Add(new ListItem("Decemeber", "12"));
            cboMonth.SelectedIndex = DateTime.Now.Month - 1;

            int x = 2007;
            while (x <= DateTime.Now.Year)
            {
                cboYear.Items.Add(new ListItem(x.ToString(), x.ToString()));
                x++;
            }
            cboYear.SelectedIndex = cboYear.Items.Count - 1;
            #endregion
        }
Beispiel #12
0
        private void Import()
        {
            if (txtPath.HasFile)
            {
                string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName);

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

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

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

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

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

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

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

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

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

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

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

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

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

                long lngProductID = 0; long lngProductCtr = 0;

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

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

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

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

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

                                clsTransferOut.Update(clsTransferOutDetails);

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

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

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

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

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

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

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

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

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

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

                                clsTransferOutItem.Insert(clsTransferOutItemDetails);

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

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

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

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

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

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

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

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

                clsTransferOut.CommitAndDispose();
                LoadRecord();
                LoadItems();
            }
            else
            {
                string stScript = "<Script>";
                stScript += "window.alert('Please select Transfer In file to upload.')";
                stScript += "</Script>";
                Response.Write(stScript);
            }
        }
Beispiel #13
0
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				Branch clsBranch = new Branch();
				clsBranch.Delete( stIDs.Substring(0,stIDs.Length-1));
				clsBranch.CommitAndDispose();
			}

			return boRetValue;
		}
        private void Synchronize()
        {
            try 
            {
                lblError.Text = string.Empty;
                
                Branch clsBranch = new Branch();
                BranchDetails clsBranchDetails = clsBranch.Details(Convert.ToInt16(cboBranch.SelectedItem.Value.ToString()));
                clsBranch.CommitAndDispose();

                if (IPAddress.IsOpen(clsBranchDetails.DBIP, int.Parse(clsBranchDetails.DBPort)) == false)
                {
                    lblError.Text = "Sorry cannot connect to Branch '" + cboBranch.SelectedItem.Text + "'. Please check you connection to IP Address :" + clsBranchDetails.DBIP + ". <br /><br />";
                    lblError.Text += "HOW TO CHECK : <br /><br />";
                    lblError.Text += "  1. Open command prompt<br />";
                    lblError.Text += "  2. Type ping[space][IP Address]<br /><br />";
                    lblError.Text += "If the answer is 'Request timed out.' then contact system administrator.<br />";
                    lblError.Text += "Else if the answer is 'Reply...' Follow the next steps.<br /><br />";
                    lblError.Text += "  3. Type telnet[space][IP Address][sapce][IP Port]<br /><br />";

                    return;
                }

                Session.Timeout = 60 * 60 * 30;
                RemoteBranchInventory clsBranchInventory = new RemoteBranchInventory();
                clsBranchInventory.GetConnectionToBranch(clsBranchDetails.DBIP);

                string[] InsertStatements = clsBranchInventory.GetInsertList(clsBranchDetails.BranchID);
                clsBranchInventory.CommitAndDispose();

                clsBranchInventory = new RemoteBranchInventory();
                clsBranchInventory.Delete(clsBranchDetails.BranchID);

                foreach (string InsertStatement in InsertStatements)
                {
                    try
                    {
                        clsBranchInventory.Insert(InsertStatement);
                        lblError.Text += InsertStatement + "<br /><br />";
                    }
                    catch {
                        lblError.Text += "<div class=ms-alternating> ERROR INSERTING ITEM: " + InsertStatement + "</div><br /><br />";
                        clsBranchInventory.Insert("';");
                    }
                    
                }

                clsBranchInventory.CommitAndDispose();

                lblError.Text = "Done synchronizing Branch: " + clsBranchDetails.BranchCode + "<br /><br />" + lblError.Text;
            }
            catch (Exception ex)
            {
                lblError.Text += "ERROR WHILE CREATING INSERT STATEMENT: " + ex.Message;
                //throw ex;
            }
        }
        private void Upload1()
        {
            //string fn = System.IO.Path.GetFileName(TextBox1.Text);
            //string SaveLocation = "/RetailPlus/temp/uploaded_" + fn;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

            clsBranchInventory.CommitAndDispose();
            lblError.Text = "<b>" + lngProductInserted.ToString() + " out of " + lngProductCtr.ToString() + " has been successfully transferred.</b><br /><br />" + lblError.Text;
        }
Beispiel #16
0
		private void LoadOptions()
		{
			Contacts clsContact = new Contacts();
            cboSupplier.DataTextField = "ContactName";
            cboSupplier.DataValueField = "ContactID";
            cboSupplier.DataSource = clsContact.SuppliersAsDataTable(null, 0, "ContactName", SortOption.Ascending).DefaultView;
			cboSupplier.DataBind();

			Branch clsBranch = new Branch(clsContact.Connection, clsContact.Transaction);
			cboBranch.DataTextField = "BranchCode";
			cboBranch.DataValueField = "BranchID";
			cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
			cboBranch.DataBind();
			clsContact.CommitAndDispose();

			cboSupplier.SelectedIndex = 0;
			cboSupplier_SelectedIndexChanged(null, null);
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));
			cboBranch_SelectedIndexChanged(null, null);

			NewTransaction();
		}
		private void LoadOptions()
		{
            Branch clsBranch = new Branch();
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            clsBranch.CommitAndDispose();

            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

            string strproductcode = string.Empty;
            try { strproductcode = Server.UrlDecode(Common.Decrypt(Server.UrlDecode(Request.QueryString["productcode"].ToString()), Session.SessionID)); }
            catch { }

            if (strproductcode == string.Empty)
            {
                cboProductCode.Items.Clear();
                cboProductCode.Items.Add(new ListItem("No Product; Enter product to search.", "0"));
            }
            else
            {
                txtProductCode.Text = strproductcode;
                cmdProductCode_Click(null, null);
            }
		}
		private void LoadOptions()
		{
            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));
            if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySales).Read)
            {
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySales, ReportTypes.SummarizeDailySales));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDay, ReportTypes.SalesPerDay));
            }
            //if (clsAccessRights.Details(UID, (int)AccessTypes.SummarizedDailySalesWithTF).Read)
            //{
            //    cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            //    cboReportType.Items.Add(new ListItem(ReportTypes.SummarizeDailySalesWithTF, ReportTypes.SummarizeDailySalesWithTF));
            //    cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerDayWithTF, ReportTypes.SalesPerDayWithTF));
            //}
            if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionReport).Read)
            {
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesPerHour, ReportTypes.SalesPerHour));
                
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactions, ReportTypes.SalesTransactions));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomer, ReportTypes.SalesTransactionPerCustomer));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroup, ReportTypes.SalesTransactionPerCustomerPerGroup));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerGroupSummarized, ReportTypes.SalesTransactionPerCustomerPerGroupSummarized));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerWithCheque, ReportTypes.SalesTransactionPerCustomerWithCheque));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCustomerPerItem, ReportTypes.SalesTransactionPerCustomerPerItem));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashier, ReportTypes.SalesTransactionPerCashier));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerCashierPerCustomer, ReportTypes.SalesTransactionPerCashierPerCustomer));
                cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerTerminal, ReportTypes.SalesTransactionPerTerminal));

                if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItem).Read)
                {
                    cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItem, ReportTypes.SalesTransactionPerItem));
                }
                if (clsAccessRights.Details(UID, (int)AccessTypes.SalesTransactionPerItemWoutPurchaseDetails).Read)
                {
                    cboReportType.Items.Add(new ListItem(ReportTypes.SalesTransactionPerItemWoutPurchaseDetails, ReportTypes.SalesTransactionPerItemWoutPurchaseDetails));
                }

                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesDaily, ReportTypes.CashSalesDaily));
                cboReportType.Items.Add(new ListItem(ReportTypes.CashSalesMonthly, ReportTypes.CashSalesMonthly));
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.ChequePaymentList, ReportTypes.ChequePaymentList));
                cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesDaily, ReportTypes.ChequeSalesDaily));
                cboReportType.Items.Add(new ListItem(ReportTypes.ChequeSalesMonthly, ReportTypes.ChequeSalesMonthly));
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesDaily, ReportTypes.CreditCardSalesDaily));
                cboReportType.Items.Add(new ListItem(ReportTypes.CreditCardSalesMonthly, ReportTypes.CreditCardSalesMonthly));
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.DailySalesTransaction, ReportTypes.DailySalesTransaction));
                cboReportType.Items.Add(new ListItem(ReportTypes.WeeklySalesTransaction, ReportTypes.WeeklySalesTransaction));
                cboReportType.Items.Add(new ListItem(ReportTypes.MonthlySalesTransaction, ReportTypes.MonthlySalesTransaction));
            }
            if (clsAccessRights.Details(UID, (int)AccessTypes.PaidOutDisburseROC).Read)
            {
                cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
                cboReportType.Items.Add(new ListItem(ReportTypes.PaidOut, ReportTypes.PaidOut));
                cboReportType.Items.Add(new ListItem(ReportTypes.Disburse, ReportTypes.Disburse));
                cboReportType.Items.Add(new ListItem(ReportTypes.RecieveOnAccount, ReportTypes.RecieveOnAccount));
            }
			cboReportType.SelectedIndex = 0;

            clsAccessRights.CommitAndDispose();

            cboConsignment.Items.Clear();
            cboConsignment.Items.Add(new ListItem("Both", "-1"));
            cboConsignment.Items.Add(new ListItem("Yes", true.ToString()));
            cboConsignment.Items.Add(new ListItem("No", false.ToString()));

			cboTransactionStatus.Items.Clear();
			foreach(string status in Enum.GetNames(typeof(TransactionStatus)))
			{
				cboTransactionStatus.Items.Add(new ListItem(status, status));
			}
			cboTransactionStatus.SelectedIndex = cboTransactionStatus.Items.IndexOf( cboTransactionStatus.Items.FindByText(TransactionStatus.NotYetApplied.ToString()));

			cboPaymentType.Items.Clear();
			foreach(string PaymentType in Enum.GetNames(typeof(PaymentTypes)))
			{
				cboPaymentType.Items.Add(new ListItem(PaymentType, PaymentType));
			}
			cboPaymentType.SelectedIndex = cboPaymentType.Items.IndexOf( cboPaymentType.Items.FindByText(PaymentTypes.NotYetAssigned.ToString()));

			txtStartValidityDate.Text = Common.ToShortDateString(DateTime.Now);
            txtEndValidityDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(30));

            txtStartTransactionDate.Text = Common.ToShortDateString(DateTime.Now.AddDays(-1));
            txtEndTransactionDate.Text = Common.ToShortDateString(DateTime.Now);
            
            Customer clsCustomer = new Customer();
            cboContactName.DataTextField = "ContactName";
            cboContactName.DataValueField = "ContactID";
            cboContactName.DataSource = clsCustomer.CustomersDataTable(txtContactName.Text, 0, false, "ContactName", SortOption.Ascending);
            cboContactName.DataBind();
            if (string.IsNullOrEmpty(txtContactName.Text))
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboContactName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactName.Text, Constants.ZERO_STRING));
            cboContactName.SelectedIndex = 0;

            ContactGroups clsContactGroups = new ContactGroups(clsCustomer.Connection, clsCustomer.Transaction);
            cboContactGroupName.DataTextField = "ContactGroupName";
            cboContactGroupName.DataValueField = "ContactGroupID";
            cboContactGroupName.DataSource = clsContactGroups.ListAsDataTable(ContactGroupCategory.CUSTOMER, txtContactGroupName.Text);
            cboContactGroupName.DataBind();
            if (string.IsNullOrEmpty(txtContactName.Text))
                cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboContactGroupName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtContactGroupName.Text, Constants.ZERO_STRING));
            cboContactGroupName.SelectedIndex = 0;


            cboAgent.Items.Clear();
            Contacts clsContact = new Contacts(clsCustomer.Connection, clsCustomer.Transaction);
            cboAgent.DataTextField = "ContactName";
            cboAgent.DataValueField = "ContactID";
            cboAgent.DataSource = clsContact.AgentsAsDataTable(txtAgent.Text, 0, "ContactName", SortOption.Ascending);
            cboAgent.DataBind();
            if (string.IsNullOrEmpty(txtAgent.Text))
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboAgent.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtAgent.Text, Constants.ZERO_STRING));
            cboAgent.SelectedIndex = 0;

            Terminal clsTerminal = new Terminal(clsCustomer.Connection, clsCustomer.Transaction);
            cboTerminalNo.DataTextField = "TerminalNo";
            cboTerminalNo.DataValueField = "TerminalNo";
            cboTerminalNo.DataSource = clsTerminal.ListAsDataTable();
            cboTerminalNo.DataBind();
            cboTerminalNo.Items.Insert(0, new ListItem(Constants.ALL, Constants.ALL));
            cboTerminalNo.SelectedIndex = 0;

            Branch clsBranch = new Branch(clsCustomer.Connection, clsCustomer.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

            Security.AccessUser clsAccessUser = new Security.AccessUser(clsCustomer.Connection, clsCustomer.Transaction);
            cboCashierName.DataTextField = "Name";
            cboCashierName.DataValueField = "UID";
            cboCashierName.DataSource = clsAccessUser.Cashiers(txtCashierName.Text, 0);
            cboCashierName.DataBind();
            if (string.IsNullOrEmpty(txtCashierName.Text))
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            else
                cboCashierName.Items.Insert(0, new ListItem(Constants.ALL + " LIKE " + txtCashierName.Text, Constants.ZERO_STRING));
            cboCashierName.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsCustomer.Connection, clsCustomer.Transaction);
            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupName";
            cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName");
            cboProductGroup.DataBind();
            cboProductGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductGroup.SelectedIndex = 0;
            clsCustomer.CommitAndDispose();

            #region Sales Per Day
            cboMonth.Items.Add(new ListItem("January", "1"));
            cboMonth.Items.Add(new ListItem("February", "2"));
            cboMonth.Items.Add(new ListItem("March", "3"));
            cboMonth.Items.Add(new ListItem("April", "4"));
            cboMonth.Items.Add(new ListItem("May", "5"));
            cboMonth.Items.Add(new ListItem("June", "6"));
            cboMonth.Items.Add(new ListItem("July", "7"));
            cboMonth.Items.Add(new ListItem("August", "8"));
            cboMonth.Items.Add(new ListItem("September", "9"));
            cboMonth.Items.Add(new ListItem("October", "10"));
            cboMonth.Items.Add(new ListItem("November", "11"));
            cboMonth.Items.Add(new ListItem("Decemeber", "12"));
            cboMonth.SelectedIndex = DateTime.Now.Month - 1;

            int x = 2007;
            while (x <= DateTime.Now.Year)
            {
                cboYear.Items.Add(new ListItem(x.ToString(), x.ToString()));
                x++;
            }
            cboYear.SelectedIndex = cboYear.Items.Count - 1;
            #endregion

        }
Beispiel #19
0
        private TerminalDetails SetDetails(System.Data.DataTable dt)
        {
            int iPersonalChargeTypeID = 0;
            int iGroupChargeTypeID = 0;

            TerminalDetails Details = new TerminalDetails();

            foreach(System.Data.DataRow dr in dt.Rows)
            {
                Details.BranchID = Int32.Parse(dr["BranchID"].ToString());
                Details.TerminalID = Int32.Parse(dr["TerminalID"].ToString());
                Details.TerminalNo = dr["TerminalNo"].ToString();
                Details.TerminalCode = dr["TerminalCode"].ToString();
                Details.TerminalName = dr["TerminalName"].ToString();
                Details.Status = (TerminalStatus)Enum.Parse(typeof(TerminalStatus), dr["Status"].ToString());
                Details.DateCreated = DateTime.Parse(dr["DateCreated"].ToString());
                Details.IsPrinterAutoCutter = bool.Parse(dr["IsPrinterAutoCutter"].ToString());
                Details.MaxReceiptWidth = Int16.Parse(dr["MaxReceiptWidth"].ToString());
                Details.TransactionNoLength = Int16.Parse(dr["TransactionNoLength"].ToString());
                Details.AutoPrint = (PrintingPreference)Enum.Parse(typeof(PrintingPreference), dr["AutoPrint"].ToString());
                Details.IsVATInclusive = bool.Parse(dr["IsVATInclusive"].ToString());
                Details.PrinterName = dr["PrinterName"].ToString();
                Details.TurretName = dr["TurretName"].ToString();
                Details.CashDrawerName = dr["CashDrawerName"].ToString();
                Details.MachineSerialNo = dr["MachineSerialNo"].ToString();
                Details.AccreditationNo = dr["AccreditationNo"].ToString();
                Details.ItemVoidConfirmation = bool.Parse(dr["ItemVoidConfirmation"].ToString());
                Details.EnableEVAT = bool.Parse(dr["EnableEVAT"].ToString());
                Details.FORM_Behavior = dr["FORM_Behavior"].ToString();
                Details.MarqueeMessage = dr["MarqueeMessage"].ToString();
                Details.TrustFund = decimal.Parse(dr["TrustFund"].ToString());
                Details.VAT = decimal.Parse(dr["VAT"].ToString());
                Details.EVAT = decimal.Parse(dr["EVAT"].ToString());
                Details.LocalTax = decimal.Parse(dr["LocalTax"].ToString());
                Details.ShowItemMoreThanZeroQty = bool.Parse(dr["ShowItemMoreThanZeroQty"].ToString());
                Details.ShowOnlyPackedTransactions = bool.Parse(dr["ShowOnlyPackedTransactions"].ToString());
                Details.ShowOneTerminalSuspendedTransactions = bool.Parse(dr["ShowOneTerminalSuspendedTransactions"].ToString());
                Details.ReceiptType = (TerminalReceiptType)Enum.Parse(typeof(TerminalReceiptType), dr["TerminalReceiptType"].ToString());
                Details.SalesInvoicePrinterName = dr["SalesInvoicePrinterName"].ToString();
                Details.CashCountBeforeReport = bool.Parse(dr["CashCountBeforeReport"].ToString());
                Details.PreviewTerminalReport = bool.Parse(dr["PreviewTerminalReport"].ToString());
                
                // Added May 5, 2009
                Details.IsPrinterDotMatrix = bool.Parse(dr["IsPrinterDotMatrix"].ToString());
                Details.IsChargeEditable = bool.Parse(dr["IsChargeEditable"].ToString());
                Details.IsDiscountEditable = bool.Parse(dr["IsDiscountEditable"].ToString());
                Details.CheckCutOffTime = bool.Parse(dr["CheckCutOffTime"].ToString());
                Details.StartCutOffTime = dr["StartCutOffTime"].ToString();
                Details.EndCutOffTime = dr["EndCutOffTime"].ToString();
                Details.WithRestaurantFeatures = bool.Parse(dr["WithRestaurantFeatures"].ToString());

                // Added Nov 8, 2011
                Details.IsFineDining = bool.Parse(dr["IsFineDIning"].ToString());

                // -- end
                
                Details.SeniorCitizenDiscountCode = dr["SeniorCitizenDiscountCode"].ToString();
                Details.PWDDiscountCode = dr["PWDDiscountCode"].ToString();

                // Added May 21, 2009
                Details.IsTouchScreen = bool.Parse(dr["IsTouchScreen"].ToString());

                // Added June 1, 2010
                Details.WillContinueSelectionVariation = bool.Parse(dr["WillContinueSelectionVariation"].ToString());
                Details.WillContinueSelectionProduct = bool.Parse(dr["WillContinueSelectionProduct"].ToString());

                // Added July 9, 2010
                Details.WSPriceMarkUp = decimal.Parse(dr["WSPriceMarkUp"].ToString());
                Details.RETPriceMarkUp = decimal.Parse(dr["RETPriceMarkUp"].ToString());

                // Added Sep 21, 2010
                Details.WillPrintGrandTotal = bool.Parse(dr["WillPrintGrandTotal"].ToString());

                // Added Apr 12, 2011
                Details.ReservedAndCommit = bool.Parse(dr["ReservedAndCommit"].ToString());       
         
                // Added Sep 10, 2011
                Details.DBVersion = dr["DBVersion"].ToString();

                // Added Oct 17, 2011
                Details.ShowCustomerSelection = bool.Parse(dr["ShowCustomerSelection"].ToString());
                Details.AutoGenerateRewardCardNo = bool.Parse(dr["AutoGenerateRewardCardNo"].ToString());

                // Added Oct 17, 2011 
                RewardPointsDetails clsRewardPointsDetails = new RewardPointsDetails();
                clsRewardPointsDetails.EnableRewardPoints = bool.Parse(dr["EnableRewardPoints"].ToString());
                clsRewardPointsDetails.RoundDownRewardPoints = bool.Parse(dr["RoundDownRewardPoints"].ToString());
                clsRewardPointsDetails.RewardPointsMinimum = decimal.Parse(dr["RewardPointsMinimum"].ToString());
                clsRewardPointsDetails.RewardPointsEvery = decimal.Parse(dr["RewardPointsEvery"].ToString());
                clsRewardPointsDetails.RewardPoints = decimal.Parse(dr["RewardPoints"].ToString());
                // Added Nov 4, 2011 :  For use as payment
                clsRewardPointsDetails.EnableRewardPointsAsPayment = bool.Parse(dr["EnableRewardPointsAsPayment"].ToString());
                clsRewardPointsDetails.RewardPointsMaxPercentageForPayment = decimal.Parse(dr["RewardPointsMaxPercentageForPayment"].ToString());
                clsRewardPointsDetails.RewardPointsPaymentValue = decimal.Parse(dr["RewardPointsPaymentValue"].ToString());
                clsRewardPointsDetails.RewardPointsPaymentCashEquivalent = decimal.Parse(dr["RewardPointsPaymentCashEquivalent"].ToString());
                clsRewardPointsDetails.RewardsPermitNo = dr["RewardsPermitNo"].ToString();

                Details.RewardPointsDetails = clsRewardPointsDetails;

                //Details.InHouseIndividualCreditPermitNo = dr["InHouseIndividualCreditPermitNo"].ToString();
                //Details.InHouseGroupCreditPermitNo = dr["InHouseGroupCreditPermitNo"].ToString();

                iPersonalChargeTypeID = Int32.Parse(dr["PersonalChargeTypeID"].ToString());
                iGroupChargeTypeID = Int32.Parse(dr["GroupChargeTypeID"].ToString());

                // Added Mar 18, 2012
                Details.ProductSearchType = (ProductSearchType)Enum.Parse(typeof(ProductSearchType), dr["ProductSearchType"].ToString());
                
                // Added Apr 29, 2013
                Details.IncludeCreditChargeAgreement = bool.Parse(dr["IncludeCreditChargeAgreement"].ToString());

                // Added Jun 30, 2013
                Details.IsParkingTerminal = bool.Parse(dr["IsParkingTerminal"].ToString());

                Details.WillPrintChargeSlip = bool.Parse(dr["WillPrintChargeSlip"].ToString());
                Details.WillPrintVoidItem = bool.Parse(dr["WillPrintVoidItem"].ToString());

                // Added Oct 20, 2013
                Details.IncludeTermsAndConditions = bool.Parse(dr["IncludeTermsAndConditions"].ToString());

                Details.DefaultTransactionChargeCode = dr["DefaultTransactionChargeCode"].ToString();
                Details.DineInChargeCode = dr["DineInChargeCode"].ToString();
                Details.TakeOutChargeCode = dr["TakeOutChargeCode"].ToString();
                Details.DeliveryChargeCode = dr["DeliveryChargeCode"].ToString();
                Details.ORSeriesBranchID = Int32.Parse(dr["ORSeriesBranchID"].ToString());
                Details.ORSeriesTerminalNo = dr["ORSeriesTerminalNo"].ToString();

                // Added Jul 4, 2015
                Details.MultiInstanceEnabled = bool.Parse(dr["MultiInstanceEnabled"].ToString());
                Details.MaskProductSearch = dr["MaskProductSearch"].ToString().Replace('*', '%');
            }

            Branch clsBranch = new Branch(base.Connection, base.Transaction);
            Details.BranchDetails = clsBranch.Details(Convert.ToInt16(Details.BranchID));

            ChargeType clsChargeType = new ChargeType(base.Connection, base.Transaction);
            if (iPersonalChargeTypeID != 0)
            { Details.PersonalChargeType = clsChargeType.Details(iPersonalChargeTypeID); }

            if (iGroupChargeTypeID != 0)
            { Details.GroupChargeType = clsChargeType.Details(iGroupChargeTypeID); }

            return Details;
        }
Beispiel #20
0
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["stockid"],Session.SessionID));
			Stock clsStock = new Stock();
			StockDetails clsDetails = clsStock.Details(iID);

            Branch clsBranch = new Branch(clsStock.Connection, clsStock.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();

			clsStock.CommitAndDispose();

			lblStockID.Text = clsDetails.StockID.ToString();
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString()));

			lblTransactionNo.Text = clsDetails.TransactionNo;
			lblStockDate.Text = clsDetails.StockDate.ToString("MMM. dd, yyy HH:mm:ss");
			txtSupplier.Text = clsDetails.SupplierName;
			lblSupplierID.Text = clsDetails.SupplierID.ToString();
            txtStockTypeCode.Text = clsDetails.StockTypeCode;
            txtStockTypeCode.ToolTip = clsDetails.StockTypeID.ToString();
            txtStockDescription.Text = clsDetails.StockTypeDescription;
            txtStockDirection.Text = clsDetails.StockDirection.ToString("G");
            txtStockRemarks.Text = clsDetails.Remarks;

			LoadItems();
		}
Beispiel #21
0
		private Int32 SaveRecord()
		{
			Branch clsBranch = new Branch();
			BranchDetails clsDetails = new BranchDetails();

			clsDetails.BranchCode = txtBranchCode.Text;
			clsDetails.BranchName = txtBranchName.Text;
			clsDetails.DBIP = txtDBIP.Text;
			clsDetails.DBPort = txtDBPort.Text;
			clsDetails.Address = txtAddress.Text;
			clsDetails.Remarks = txtRemarks.Text;
            clsDetails.IncludeIneSales = chkIncludeIneSales.Checked;

			int id = clsBranch.Insert(clsDetails);
			
			clsBranch.CommitAndDispose();

			return id;
		}
Beispiel #22
0
		private void LoadOptions()
		{
			Contacts clsContact = new Contacts();
            cboSupplier.DataTextField = "ContactName";
			cboSupplier.DataValueField = "ContactID";
            cboSupplier.DataSource = clsContact.SuppliersAsDataTable(null, 0, "ContactName", SortOption.Ascending).DefaultView;
			cboSupplier.DataBind();

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

			Branch clsBranch = new Branch(clsContact.Connection, clsContact.Transaction);
			cboBranch.DataTextField = "BranchCode";
			cboBranch.DataValueField = "BranchID";
			cboBranch.DataSource = clsBranch.ListAsDataTable(OnlyIncludeIneSales: boIsePurchaseOrder).DefaultView;
			cboBranch.DataBind();

			clsContact.CommitAndDispose();

			cboSupplier.SelectedIndex = 0;
			cboSupplier_SelectedIndexChanged(null, null);
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));
			cboBranch_SelectedIndexChanged(null, null);

            lblIsePurchaseOrder.Text = boIsePurchaseOrder ? "true" : "false";

			NewTransaction();
		}
Beispiel #23
0
        protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
            string stParam = string.Empty;
            switch (e.CommandName)
            {
                case "imgItemDelete":
                    Branch clsBranch = new Branch();
                    clsBranch.Delete(chkList.Value);
                    clsBranch.CommitAndDispose();

                    LoadList();
                    break;
                case "imgItemEdit":
                    stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
            }
        }
        private void SynchronizeFromBranch()
        {
            try
            {
                lblError.Text = string.Empty;

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

                if (IPAddress.IsOpen(clsBranchDetails.DBIP, int.Parse(clsBranchDetails.DBPort)) == false)
                {
                    lblError.Text = "Sorry cannot connect to Branch '" + cboSynchronizeFromBranch.SelectedItem.Text + "'. Please check you connection to IP Address :" + clsBranchDetails.DBIP + ". <br /><br />";
                    lblError.Text += "HOW TO CHECK : <br /><br />";
                    lblError.Text += "  1. Open command prompt<br />";
                    lblError.Text += "  2. Type ping[space][IP Address]<br /><br />";
                    lblError.Text += "If the answer is 'Request timed out.' then contact system administrator.<br />";
                    lblError.Text += "Else if the answer is 'Reply...' Follow the next steps.<br /><br />";
                    lblError.Text += "  3. Type telnet[space][IP Address][sapce][IP Port]<br /><br />";

                    return;
                }

                Session.Timeout = 60 * 60 * 30;

                Products clsProduct = new Products();
                clsProduct.GetConnection();
                ProductDetails clsProductDetails;
                ContactGroups clsContactGroup = new ContactGroups(clsProduct.Connection, clsProduct.Transaction);
                Contacts clsContact = new Contacts(clsProduct.Connection, clsProduct.Transaction);
                Data.Unit clsUnit = new Data.Unit(clsProduct.Connection, clsProduct.Transaction);
                Data.ProductGroup clsProductGroup = new Data.ProductGroup(clsProduct.Connection, clsProduct.Transaction);
                Data.ProductSubGroup clsProductSubGroup = new Data.ProductSubGroup(clsProduct.Connection, clsProduct.Transaction);
                Data.Variation clsVariation = new Variation(clsProduct.Connection, clsProduct.Transaction);

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

                Products clsBranchProduct = new Products(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                ProductDetails[] arrBranchProductDetails = clsBranchProduct.List();

                ContactGroups clsBranchContactGroup = new ContactGroups(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                Contacts clsBranchContact = new Contacts(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                Data.Unit clsBranchUnit = new Data.Unit(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                Data.ProductGroup clsBranchProductGroup = new Data.ProductGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                Data.ProductSubGroup clsBranchProductSubGroup = new Data.ProductSubGroup(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                Data.Variation clsBranchVariation = new Variation(clsBranchInventory.Connection, clsBranchInventory.Transaction);
                
                foreach (ProductDetails clsBranchProductDetails in arrBranchProductDetails)
                {
                    clsProductDetails = clsBranchProductDetails;
                    try
                    {
                        clsProductDetails.ProductID = clsProduct.Details(clsProductDetails.BarCode).ProductID;
                        if (clsProductDetails.ProductID != 0)
                        {
                            lblError.Text += clsProductDetails.BarCode + " already exist.<br /><br />";
                            clsProduct.UpdatePurchasing(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.PurchasePrice);
                            clsProduct.UpdateSellingPrice(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.Price, clsProductDetails.Price1, clsProductDetails.Price2, clsProductDetails.Price3, clsProductDetails.Price4, clsProductDetails.Price5);
                        }
                        else
                        {
                            clsProductDetails.ProductID = clsProduct.DetailsByCode(Constants.BRANCH_ID_MAIN, clsProductDetails.BarCode).ProductID;
                            if (clsProductDetails.ProductID != 0)
                            {
                                lblError.Text += clsProductDetails.ProductCode + " already exist.<br /><br />";
                                clsProduct.UpdateBarcode(clsProductDetails.ProductID, clsProductDetails.BarCode);
                                clsProduct.UpdatePurchasing(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.PurchasePrice);
                                clsProduct.UpdateSellingPrice(clsProductDetails.ProductID, clsBranchProductDetails.MatrixID, clsProductDetails.SupplierID, clsProductDetails.BaseUnitID, clsProductDetails.Price, clsProductDetails.Price1, clsProductDetails.Price2, clsProductDetails.Price3, clsProductDetails.Price4, clsProductDetails.Price5);
                            }
                            else
                            {
                                clsProductDetails.SupplierID = clsContact.Details(clsProductDetails.SupplierCode).ContactID;
                                if (clsProductDetails.SupplierID == 0)
                                {
                                    ContactDetails clsBranchContactDetails = clsBranchContact.Details(clsProductDetails.SupplierCode);
                                    if (clsContactGroup.Details(clsBranchContactDetails.ContactGroupID).ContactGroupID == 0)
                                    {
                                        ContactGroupDetails clsBranchContactGroupDetails = clsBranchContactGroup.Details(clsBranchContactDetails.ContactGroupID);
                                        clsBranchContactDetails.ContactGroupID = clsContactGroup.Insert(clsBranchContactGroupDetails);
                                    }
                                    clsProductDetails.SupplierID = clsContact.Insert(clsBranchContactDetails);
                                }

                                clsProductDetails.BaseUnitID = clsUnit.Details(clsProductDetails.BaseUnitCode).UnitID;
                                if (clsProductDetails.BaseUnitID == 0)
                                {
                                    UnitDetails clsBranchUnitDetails = clsBranchUnit.Details(clsBranchProductDetails.BaseUnitID);
                                    clsProductDetails.BaseUnitID = clsUnit.Insert(clsBranchUnitDetails);
                                }

                                clsProductDetails.ProductGroupID = clsProductGroup.Details(clsProductDetails.ProductGroupCode).ProductGroupID;
                                if (clsProductDetails.ProductGroupID == 0)
                                {
                                    ProductGroupDetails clsBranchProductGroupDetails = clsBranchProductGroup.Details(clsBranchProductDetails.ProductGroupID);
                                    clsProductDetails.ProductGroupID = clsProductGroup.Insert(clsBranchProductGroupDetails);
                                }

                                clsProductDetails.ProductSubGroupID = clsProductSubGroup.Details(clsProductDetails.ProductSubGroupCode).ProductSubGroupID;
                                if (clsProductDetails.ProductSubGroupID == 0)
                                {
                                    ProductSubGroupDetails clsBranchProductSubGroupDetails = clsBranchProductSubGroup.Details(clsBranchProductDetails.ProductSubGroupID);
                                    clsProductDetails.ProductSubGroupID = clsProductSubGroup.Insert(clsBranchProductSubGroupDetails);
                                }

                                clsProductDetails.Quantity = 0;
                                clsProductDetails.QuantityIN = 0;
                                clsProductDetails.QuantityOUT = 0;

                                try
                                {
                                    clsProductDetails.ProductID = clsProduct.Insert(clsProductDetails);
                                    lblError.Text += clsProductDetails.ProductCode + " inserted.<br /><br />";
                                }
                                catch (Exception exProduct){
                                    lblError.Text += "<div class=ms-alternating> ERROR INSERTING ITEM: " + clsProductDetails.ProductCode + " err: " + exProduct.Message + ".</div><br /><br />";
                                    if (clsProduct.Connection.State == ConnectionState.Closed)
                                    {
                                        clsProduct = new Products();
                                        clsProduct.GetConnection();
                                        clsContactGroup = new ContactGroups(clsProduct.Connection, clsProduct.Transaction);
                                        clsContact = new Contacts(clsProduct.Connection, clsProduct.Transaction);
                                        clsUnit = new Data.Unit(clsProduct.Connection, clsProduct.Transaction);
                                        clsProductGroup = new Data.ProductGroup(clsProduct.Connection, clsProduct.Transaction);
                                        clsProductSubGroup = new Data.ProductSubGroup(clsProduct.Connection, clsProduct.Transaction);
                                        clsVariation = new Variation(clsProduct.Connection, clsProduct.Transaction);
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception exProducts)
                    {
                        lblError.Text += "<div class=ms-alternating> ERROR INSERTING ITEM: " + clsProductDetails.ProductCode + " err: " + exProducts.Message + ".</div><br /><br />";
                        if (clsProduct.Connection.State == ConnectionState.Closed)
                        {
                            clsProduct = new Products();
                            clsProduct.GetConnection();
                            clsContactGroup = new ContactGroups(clsProduct.Connection, clsProduct.Transaction);
                            clsContact = new Contacts(clsProduct.Connection, clsProduct.Transaction);
                            clsUnit = new Data.Unit(clsProduct.Connection, clsProduct.Transaction);
                            clsProductGroup = new Data.ProductGroup(clsProduct.Connection, clsProduct.Transaction);
                            clsProductSubGroup = new Data.ProductSubGroup(clsProduct.Connection, clsProduct.Transaction);
                            clsVariation = new Variation(clsProduct.Connection, clsProduct.Transaction);
                        }
                    }
                }

                clsProduct.CommitAndDispose();
                clsBranchInventory.CommitAndDispose();

                lblError.Text = "Done synchronizing products from Branch: " + clsBranchDetails.BranchCode + "<br /><br />" + lblError.Text;
            }
            catch (Exception ex)
            {
                lblError.Text += "ERROR WHILE CREATING INSERT STATEMENT: " + ex.Message;
            }
        }
Beispiel #25
0
        protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
		{
			if(e.Item.ItemType == ListItemType.Header)
			{
				LoadSortFieldOptions(e);
			}
			else if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
			{
				DataRowView dr = (DataRowView) e.Item.DataItem;				

				HtmlInputCheckBox chkList = (HtmlInputCheckBox) e.Item.FindControl("chkList");
				chkList.Value = dr["TerminalID"].ToString();

				HyperLink lnkTerminalNo = (HyperLink) e.Item.FindControl("lnkTerminalNo");
				lnkTerminalNo.Text = dr["TerminalNo"].ToString();

                Label lblBranchID = (Label)e.Item.FindControl("lblBranchID");
                lblBranchID.Text = dr["BranchID"].ToString();

                Data.Branch clsBranch = new Branch();
                Data.BranchDetails clsBranchDetails = clsBranch.Details(Int32.Parse(lblBranchID.Text));
                clsBranch.CommitAndDispose();
                lblBranchID.Text = clsBranchDetails.BranchCode;

				HyperLink lnkTerminalCode = (HyperLink) e.Item.FindControl("lnkTerminalCode");
				lnkTerminalCode.Text = dr["TerminalCode"].ToString();

				HyperLink lnkTerminalName = (HyperLink) e.Item.FindControl("lnkTerminalName");
				lnkTerminalName.Text = dr["TerminalName"].ToString();

				HyperLink lnkMachineSerialNo = (HyperLink) e.Item.FindControl("lnkMachineSerialNo");
				lnkMachineSerialNo.Text = dr["MachineSerialNo"].ToString();
				
				HyperLink lnkAccreditationNo = (HyperLink) e.Item.FindControl("lnkAccreditationNo");
				lnkAccreditationNo.Text = dr["AccreditationNo"].ToString();

				HyperLink lnkStatus = (HyperLink) e.Item.FindControl("lnkStatus");
				TerminalStatus status = (TerminalStatus) Enum.Parse(typeof(TerminalStatus), dr["Status"].ToString());
				lnkStatus.Text = status.ToString("G");
	
				Label lblDateCreated = (Label) e.Item.FindControl("lblDateCreated");
				lblDateCreated.Text = dr["DateCreated"].ToString();

				Label lblMaxReceiptWidth = (Label) e.Item.FindControl("lblMaxReceiptWidth");
				lblMaxReceiptWidth.Text = dr["MaxReceiptWidth"].ToString();

				CheckBox chkIsPrinterAutoCutter = (CheckBox) e.Item.FindControl("chkIsPrinterAutoCutter");
				chkIsPrinterAutoCutter.Checked = Convert.ToBoolean(dr["IsPrinterAutoCutter"]);

				CheckBox chkAutoPrint = (CheckBox) e.Item.FindControl("chkAutoPrint");
				chkAutoPrint.Checked = Convert.ToBoolean(Convert.ToInt16(dr["AutoPrint"].ToString()));

				Label lblPrinterName = (Label) e.Item.FindControl("lblPrinterName");
				lblPrinterName.Text = dr["PrinterName"].ToString();

				Label lblCashDrawerName = (Label) e.Item.FindControl("lblCashDrawerName");				
				lblCashDrawerName.Text = dr["CashDrawerName"].ToString();

				CheckBox chkItemVoidConfirmation = (CheckBox) e.Item.FindControl("chkItemVoidConfirmation");
				chkItemVoidConfirmation.Checked =Convert.ToBoolean(dr["ItemVoidConfirmation"]);
				
				CheckBox chkEnableEVAT = (CheckBox) e.Item.FindControl("chkEnableEVAT");
				chkEnableEVAT.Checked =Convert.ToBoolean(dr["EnableEVAT"]);

				Label lblFormBehavior = (Label) e.Item.FindControl("lblFormBehavior");
				lblFormBehavior.Text = dr["Form_Behavior"].ToString();

				Label lblMarqueeMessage = (Label) e.Item.FindControl("lblMarqueeMessage");
				lblMarqueeMessage.Text = dr["MarqueeMessage"].ToString();
				
				//For anchor
				HtmlGenericControl divExpCollAsst = (HtmlGenericControl) e.Item.FindControl("divExpCollAsst");

				HtmlAnchor anchorDown = (HtmlAnchor) e.Item.FindControl("anchorDown");
				anchorDown.HRef = "javascript:ToggleDiv('" +  divExpCollAsst.ClientID + "')";
			}
		}
		private void LoadOptions()
		{
            Int64 UID = Convert.ToInt64(Session["UID"]);
            Security.AccessRights clsAccessRights = new Security.AccessRights();

            cboReportType.Items.Clear();
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION, ReportTypes.REPORT_SELECTION));
            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            cboReportType.Items.Add(new ListItem(ReportTypes.ProductHistoryMovement, ReportTypes.ProductHistoryMovement));

            if (clsAccessRights.Details(UID, (int)AccessTypes.PricesReport).Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.ProductHistoryPrice, ReportTypes.ProductHistoryPrice));

            cboReportType.Items.Add(new ListItem(ReportTypes.REPORT_SELECTION_SEPARATOR, ReportTypes.REPORT_SELECTION_SEPARATOR));
            if (clsAccessRights.Details(UID, (int)AccessTypes.MostSalableItemsReport).Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.ProductHistoryMostSaleable, ReportTypes.ProductHistoryMostSaleable));

            if (clsAccessRights.Details(UID, (int)AccessTypes.LeastSalableItemsReport).Read)
                cboReportType.Items.Add(new ListItem(ReportTypes.ProductHistoryLeastSaleable, ReportTypes.ProductHistoryLeastSaleable));

            clsAccessRights.CommitAndDispose();

            cboReportType.SelectedIndex = 0;
            try
            {
                if (Common.Decrypt(Request.QueryString["task"].ToString().ToLower(), Session.SessionID) == "producthistory")
                {
                    cboReportType.SelectedIndex = cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.ProductHistoryMovement));
                    cboReportType_SelectedIndexChanged(null, null);
                }
            }
            catch {}
            try
            {
                if (Common.Decrypt(Request.QueryString["task"].ToString().ToLower(), Session.SessionID) == "pricehistory")
                {
                    cboReportType.SelectedIndex = cboReportType.Items.IndexOf(cboReportType.Items.FindByValue(ReportTypes.ProductHistoryPrice));
                    cboReportType_SelectedIndexChanged(null, null);
                }
            }
            catch { }

			txtStartDate.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
			txtEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd");

            string strProductCode = string.Empty;
            try
            {
                try
                {
                    if (Request.QueryString["sender"].ToString().ToLower() == "direct" && Request.QueryString["productcode"].ToString() != null)
                        strProductCode = Server.UrlDecode(Request.QueryString["productcode"].ToString());
                }
                catch { strProductCode = Server.UrlDecode(Common.Decrypt(Request.QueryString["productcode"].ToString(), Session.SessionID)); }
                lblReferrer.ToolTip = strProductCode;
            }
            catch { strProductCode = lblReferrer.ToolTip; }

            txtProductCode.Text = strProductCode;

			Data.Products clsProduct = new Data.Products();
			cboProductCode.DataTextField = "ProductCode";
			cboProductCode.DataValueField = "ProductID";
            cboProductCode.DataSource = clsProduct.ProductIDandCodeDataTable(SearchKey: txtProductCode.Text, limit: 100);
            cboProductCode.DataBind();

            Branch clsBranch = new Branch(clsProduct.Connection, clsProduct.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            cboBranch.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboBranch.SelectedIndex = 0;

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

			cboProductCode.SelectedIndex = 0;
            cboProductCode_SelectedIndexChanged(null, null);
            try
            {
                if (strProductCode != string.Empty && cboProductCode.SelectedItem.Value != "0")
                {
                    if (!string.IsNullOrEmpty(Request.QueryString["reptype"]))
                        GeneratePDF();
                    else 
                        GenerateHTML();
                }
            }
            catch { }
		}
Beispiel #27
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);
        }
Beispiel #28
0
		private void SaveRecord()
		{
			Branch clsBranch = new Branch();
			BranchDetails clsDetails = new BranchDetails();

			clsDetails.BranchID = Convert.ToInt32(lblBranchID.Text);
			clsDetails.BranchCode = txtBranchCode.Text;
			clsDetails.BranchName = txtBranchName.Text;
			clsDetails.DBIP = txtDBIP.Text;
			clsDetails.DBPort = txtDBPort.Text;
			clsDetails.Address = txtAddress.Text;
			clsDetails.Remarks = txtRemarks.Text;
            clsDetails.IncludeIneSales = chkIncludeIneSales.Checked;

			clsBranch.Update(clsDetails);
			clsBranch.CommitAndDispose();
		}
Beispiel #29
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			StockTypes clsStockTypes = new StockTypes();
			cboStockTypes.DataTextField = "StockTypeCode";
			cboStockTypes.DataValueField = "StockTypeID";
			cboStockTypes.DataSource = clsDataClass.DataReaderToDataTable(clsStockTypes.List("StockTypeCode", SortOption.Ascending)).DefaultView;
			cboStockTypes.DataBind();
			cboStockTypes.SelectedIndex = cboStockTypes.Items.Count - 1;

            Contacts clsContact = new Contacts(clsStockTypes.Connection, clsStockTypes.Transaction);
			cboSupplier.DataTextField = "ContactName";
			cboSupplier.DataValueField = "ContactID";
			cboSupplier.DataSource = clsDataClass.DataReaderToDataTable(clsContact.Suppliers(null, 0, "ContactName", SortOption.Ascending)).DefaultView;
			cboSupplier.DataBind();

            Branch clsBranch = new Branch(clsStockTypes.Connection, clsStockTypes.Transaction);
            cboBranch.DataTextField = "BranchCode";
            cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
            cboBranch.DataBind();
            
            clsStockTypes.CommitAndDispose();

            cboStockTypes_SelectedIndexChanged(null, null);
            cboSupplier.SelectedIndex = 0;
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

			NewTransaction();
		}
Beispiel #30
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			Contacts clsContact = new Contacts();
            cboSupplier.DataTextField = "ContactName";
            cboSupplier.DataValueField = "ContactID";
            cboSupplier.DataSource = clsContact.SuppliersAsDataTable(null, 0, "ContactName", SortOption.Ascending).DefaultView;
			cboSupplier.DataBind();
			clsContact.CommitAndDispose();
			cboSupplier.SelectedIndex = 0;
			cboSupplier_SelectedIndexChanged(null, null);

            bool boIsePurchaseOrder = bool.TryParse(Common.Decrypt(Request.QueryString["isepurchaseorder"].ToString(), Session.SessionID), out boIsePurchaseOrder) ? boIsePurchaseOrder : false;

			Branch clsBranch = new Branch();
			cboBranch.DataTextField = "BranchCode";
			cboBranch.DataValueField = "BranchID";
            cboBranch.DataSource = clsBranch.ListAsDataTable(OnlyIncludeIneSales: boIsePurchaseOrder).DefaultView;
			cboBranch.DataBind();
			clsBranch.CommitAndDispose();
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));
			cboBranch_SelectedIndexChanged(null, null);
		}