private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(); cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboSubGroup.DataBind(); cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING)); cboSubGroup.SelectedIndex = 0; Contacts clsContact = new Contacts(clsProductGroup.Connection, clsProductGroup.Transaction); cboSupplier.DataTextField = "ContactName"; cboSupplier.DataValueField = "ContactID"; cboSupplier.DataSource = clsContact.SuppliersAsDataTable(string.Empty, 0, "ContactName", SortOption.Ascending); cboSupplier.DataBind(); cboSupplier.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboSupplier.SelectedIndex = cboSupplier.Items.Count - 1; clsProductGroup.CommitAndDispose(); txtStartTransactionDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); txtEndTransactionDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); }
protected void Page_Load(object sender, System.EventArgs e) { const string defaultHeading = "Master Files"; string stHeading = defaultHeading; const string defaultTitle = "List of Product SubGroup Unit Matrix"; SiteTitle.Title = defaultTitle; const SearchCategoryID defaultSearchIndex = SearchCategoryID.ProductSubGroups; SearchCategoryID SearchIndex = defaultSearchIndex; HorizontalNavBar.PageNavigatorid = HorizontalNavID.MasterFiles; if (Request.QueryString["task"]!=null) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsDetails = new ProductSubGroupDetails(); int id = Convert.ToInt16(Common.Decrypt(Request.QueryString["subgroupid"].ToString(), Session.SessionID)); clsDetails = clsProductSubGroup.Details(id); clsProductSubGroup.CommitAndDispose(); string groupCode = " for Product SubGroup : " + clsDetails.ProductSubGroupName; string task = Common.Decrypt(Request.QueryString["task"].ToString(),Session.SessionID); switch(task) { case "add": stHeading = "Register New Unit Matrix"; SearchIndex = SearchCategoryID.ProductVariations; ctrlInsert.Visible = true; break; case "edit": stHeading = "Modify Unit Matrix"; SearchIndex = SearchCategoryID.ProductVariations; ctrlUpdate.Visible = true; break; case "list": stHeading = "Unit Matrix List"; SearchIndex = SearchCategoryID.ProductVariations; ctrlList.Visible = true; break; default: break; } LargeHeading.Text = stHeading + groupCode; RightBodySectionSearch.SearchIDSelectedItem = SearchIndex; } }
private void LoadOptions() { ProductGroup clsProductGroup = new ProductGroup(); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(); cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboSubGroup.DataBind(); cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING)); cboSubGroup.SelectedIndex = 0; clsProductGroup.CommitAndDispose(); }
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; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductSubGroupName = txtProductSubGroup.Text }; ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsBranch.Connection, clsBranch.Transaction); cboProductSubGroup.DataTextField = "ProductSubGroupName"; cboProductSubGroup.DataValueField = "ProductSubGroupID"; cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView; cboProductSubGroup.DataBind(); cboProductSubGroup.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();"); } }
protected void cboProductGroup_SelectedIndexChanged(object sender, EventArgs e) { Int64 intProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); ProductSubGroup clsProductSubGroup = new ProductSubGroup(); clsProductSubGroup.GetConnection(); ProductGroup clsProductGroup = new ProductGroup(clsProductSubGroup.Connection, clsProductSubGroup.Transaction); ProductGroupDetails clsDetails; //System.Data.DataTable dtProductSubGroup; if (intProductGroupID == 0) { clsDetails = clsProductGroup.Details(DataConstants.DEFAULT_PRODUCT_GROUP); } else { clsDetails = clsProductGroup.Details(intProductGroupID); } ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails() { ProductGroupID = intProductGroupID }; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); cboProductSubGroup.DataTextField = "ProductSubGroupName"; cboProductSubGroup.DataValueField = "ProductSubGroupID"; cboProductSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboProductSubGroup.DataBind(); cboProductSubGroup.Items.Insert(0, new ListItem("Do not Apply to Product Sub Groups", "-1")); cboProductSubGroup.Items.Insert(1, new ListItem("Apply to all Product Sub Groups", "0")); cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1; clsProductSubGroup.CommitAndDispose(); cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.IndexOf(cboChartOfAccountPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDPurchase.ToString())); cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.IndexOf(cboChartOfAccountSold.Items.FindByValue(clsDetails.ChartOfAccountIDSold.ToString())); cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.IndexOf(cboChartOfAccountInventory.Items.FindByValue(clsDetails.ChartOfAccountIDInventory.ToString())); cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.IndexOf(cboChartOfAccountIDTaxPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDTaxPurchase.ToString())); cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.IndexOf(cboChartOfAccountIDTaxSold.Items.FindByValue(clsDetails.ChartOfAccountIDTaxSold.ToString())); }
private void LoadList() { string SortField = "ProductCode"; 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); } Int64 lngProductSubGroupID = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value); ProductInventories clsProductInventories = new ProductInventories(); System.Data.DataTable dt = clsProductInventories.ListAsDataTable(BranchID: int.Parse(cboBranch.SelectedItem.Value), ProductSubGroupID: lngProductSubGroupID, clsProductListFilterType: ProductListFilterType.ShowActiveOnly, SortField: "ProductCode ASC, MatrixDescription ASC, BarCode1", SortOrder: SortOption.Desscending); ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsProductInventories.Connection, clsProductInventories.Transaction); ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(lngProductSubGroupID); clsProductInventories.CommitAndDispose(); PageData.DataSource = dt.DefaultView; if (!clsProductSubGroupDetails.isLock) { cmdLockUnlockProduct.Text = "Lock Product Group [<label class='ms-error'>Note:</label>Products under this group are <u>CURRENTLY ALLOWED</u> for Selling]"; cmdLockUnlockProduct.ToolTip = "unlock"; } else { cmdLockUnlockProduct.Text = "UnLock Product Group [<label class='ms-error'>Note:</label>Products under this group are <u>CURRENTLY NOT ALLOWED</u> for Selling]"; cmdLockUnlockProduct.ToolTip = "lock"; } int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = 5000; 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 iRow = 0; iRow < PageData.PageCount; iRow++) { int iValue = iRow + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == iRow) { cboCurrentPage.Items[iRow].Selected = true; } else { cboCurrentPage.Items[iRow].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; }
private void LoadOptions() { txtStartTransactionDate.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd"); txtEndTransactionDate.Text = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"); Contacts clsContact = new Contacts(); cboContact.DataTextField = "ContactName"; cboContact.DataValueField = "ContactID"; cboContact.DataSource = clsContact.SuppliersAsDataTable(Limit: 100).DefaultView; cboContact.DataBind(); cboContact.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.ZERO_STRING)); cboContact.SelectedIndex = 0; ProductGroup clsProductGroup = new ProductGroup(clsContact.Connection, clsContact.Transaction); cboGroup.DataTextField = "ProductGroupName"; cboGroup.DataValueField = "ProductGroupID"; cboGroup.DataSource = clsProductGroup.ListAsDataTable(); cboGroup.DataBind(); cboGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT,Constants.ZERO_STRING)); cboGroup.SelectedIndex = 0; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsContact.Connection, clsContact.Transaction); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns); cboSubGroup.DataBind(); cboSubGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.ZERO_STRING)); cboSubGroup.SelectedIndex = 0; Data.Inventory clsInventory = new Data.Inventory(clsContact.Connection, clsContact.Transaction); cboInventoryNo.DataTextField = "ReferenceNo"; cboInventoryNo.DataValueField = "PostingReference"; cboInventoryNo.DataSource = clsInventory.ClosingInventoryReferenceNos(Convert.ToDateTime(txtStartTransactionDate.Text), Convert.ToDateTime(txtEndTransactionDate.Text)); cboInventoryNo.DataBind(); cboInventoryNo.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT + DateTime.MinValue.ToString("yyyy-MM-dd"))); cboInventoryNo.SelectedIndex = 0; clsContact.CommitAndDispose(); lblType.Text = ""; lblType.ToolTip = ""; if (Request.QueryString["type"] != null) { lblType.Text = Common.Decrypt(Request.QueryString["type"].ToString(), Session.SessionID); } if (Request.QueryString["typedet"] != null) { lblType.ToolTip = Common.Decrypt(Request.QueryString["typedet"].ToString(), Session.SessionID); } lblBranchID.Text = "0"; if (Request.QueryString["branchid"] != null) { lblBranchID.Text = Common.Decrypt(Request.QueryString["branchid"].ToString(), Session.SessionID); } if (Request.QueryString["refno"] != null) { string strRefNo = "refno"; strRefNo = Common.Decrypt(Request.QueryString["refno"].ToString(), Session.SessionID); cboInventoryNo.SelectedIndex = cboInventoryNo.Items.IndexOf(cboInventoryNo.Items.FindByText(strRefNo)); } if (Request.QueryString["prdgrpid"] != null) { string strPrdGrpID = "prdgrpid"; strPrdGrpID = Common.Decrypt(Request.QueryString["prdgrpid"].ToString(), Session.SessionID); cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(strPrdGrpID)); } if (Request.QueryString["contactid"] != null) { string strContactID = "contactid"; strContactID = Common.Decrypt(Request.QueryString["contactid"].ToString(), Session.SessionID); cboContact.SelectedIndex = cboContact.Items.IndexOf(cboContact.Items.FindByValue(strContactID)); } }
protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e) { ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns(); clsProductSubGroupColumns.ProductSubGroupCode = true; clsProductSubGroupColumns.ProductSubGroupName = true; ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails(); clsSearchKeys.ProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value); clsSearchKeys.ProductSubGroupCode = txtSubGroupCode.Text; ProductSubGroup clsSubGroup = new ProductSubGroup(); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, 0); cboSubGroup.DataBind(); cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING)); if (cboSubGroup.Items.Count > 1 && txtSubGroupCode.Text.Trim() != string.Empty) cboSubGroup.SelectedIndex = 1; else cboSubGroup.SelectedIndex = 0; clsSubGroup.CommitAndDispose(); cboProductSubGroup_SelectedIndexChanged(null, System.EventArgs.Empty); }
private void LoadRecord() { Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID)); ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsDetails = clsProductSubGroup.Details(iID); clsProductSubGroup.CommitAndDispose(); lblProductSubGroupID.Text = clsDetails.ProductSubGroupID.ToString(); cboGroup.SelectedIndex = cboGroup.Items.IndexOf( cboGroup.Items.FindByValue(clsDetails.ProductGroupID.ToString())); txtProductSubGroupCode.Text = clsDetails.ProductSubGroupCode; txtProductSubGroupName.Text = clsDetails.ProductSubGroupName; cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(clsDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0"); }
protected void cboProductSubGroup_SelectedIndexChanged(object sender, System.EventArgs e) { try { LoadProduct(); if (cboProductSubGroup.SelectedItem.Value != Constants.ZERO_STRING) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(long.Parse(cboProductSubGroup.SelectedItem.Value)); clsProductSubGroup.CommitAndDispose(); txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0"); } } catch (Exception ex) { throw ex; } }
private void SaveRecord() { long lProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); long lProductSubGroupID = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value); long lProductID = Convert.ToInt64(cboProduct.SelectedItem.Value); int iChartOfAccountIDPurchase = Convert.ToInt32(cboChartOfAccountPurchase.SelectedItem.Value); int iChartOfAccountIDSold = Convert.ToInt32(cboChartOfAccountSold.SelectedItem.Value); int iChartOfAccountIDInventory = Convert.ToInt32(cboChartOfAccountInventory.SelectedItem.Value); int iChartOfAccountIDTaxPurchase = Convert.ToInt32(cboChartOfAccountIDTaxPurchase.SelectedItem.Value); int iChartOfAccountIDTaxSold = Convert.ToInt32(cboChartOfAccountIDTaxSold.SelectedItem.Value); ProductGroup clsProductGroup = new ProductGroup(); clsProductGroup.GetConnection(); ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction); Products clsProduct = new Products(clsProductGroup.Connection,clsProductGroup.Transaction); if (lProductGroupID == 0) { clsProductGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductSubGroupID == 0) { clsProductSubGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } else if (lProductSubGroupID > 0) { clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } } else { clsProductGroup.UpdateFinancialInformation(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductSubGroupID == 0) { clsProductSubGroup.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } else if (lProductSubGroupID > 0) { clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); if (lProductID == 0) { clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } else { clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold); } } } clsProductGroup.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); ChartOfAccounts clsChartOfAccount = new ChartOfAccounts(); System.Data.DataTable dtList = clsDataClass.DataReaderToDataTable(clsChartOfAccount.List("ChartOfAccountName", SortOption.Ascending)); ProductGroup clsProductGroup = new ProductGroup(clsChartOfAccount.Connection, clsChartOfAccount.Transaction); System.Data.DataTable dtProductGroup = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName"); ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsSubGroup = new ProductSubGroup(clsChartOfAccount.Connection, clsChartOfAccount.Transaction); System.Data.DataTable dtProductSubGroup = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); Products clsProduct = new Products(clsChartOfAccount.Connection, clsChartOfAccount.Transaction); System.Data.DataTable dtProduct = clsProduct.ListAsDataTable("ProductID", SortOption.Ascending); clsChartOfAccount.CommitAndDispose(); cboProductGroup.DataTextField = "ProductGroupName"; cboProductGroup.DataValueField = "ProductGroupID"; cboProductGroup.DataSource = dtProductGroup.DefaultView; cboProductGroup.DataBind(); cboProductGroup.Items.Add(new ListItem("Apply to all Product Groups", "0")); cboProductGroup.SelectedIndex = cboProductGroup.Items.Count - 1; cboProductSubGroup.DataTextField = "ProductSubGroupName"; cboProductSubGroup.DataValueField = "ProductSubGroupID"; cboProductSubGroup.DataSource = dtProductSubGroup.DefaultView; cboProductSubGroup.DataBind(); cboProductSubGroup.Items.Add(new ListItem("Do not Apply to Product Sub Groups", "-1")); cboProductSubGroup.Items.Add(new ListItem("Apply to all Product Sub Groups", "0")); cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1; cboProduct.DataTextField = "ProductCode"; cboProduct.DataValueField = "ProductID"; cboProduct.DataSource = dtProduct.DefaultView; cboProduct.DataBind(); cboProduct.Items.Add(new ListItem("Do not Apply to Products", "-1")); cboProduct.Items.Add(new ListItem("Apply to all Products", "0")); cboProduct.SelectedIndex = cboProduct.Items.Count - 1; cboChartOfAccountPurchase.DataTextField = "ChartOfAccountNameComplete"; cboChartOfAccountPurchase.DataValueField = "ChartOfAccountID"; cboChartOfAccountPurchase.DataSource = dtList.DefaultView; cboChartOfAccountPurchase.DataBind(); cboChartOfAccountPurchase.Items.Add(new ListItem("Not Applicable", "0")); cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.Count - 1; cboChartOfAccountSold.DataTextField = "ChartOfAccountNameComplete"; cboChartOfAccountSold.DataValueField = "ChartOfAccountID"; cboChartOfAccountSold.DataSource = dtList.DefaultView; cboChartOfAccountSold.DataBind(); cboChartOfAccountSold.Items.Add(new ListItem("Not Applicable", "0")); cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.Count - 1; cboChartOfAccountInventory.DataTextField = "ChartOfAccountNameComplete"; cboChartOfAccountInventory.DataValueField = "ChartOfAccountID"; cboChartOfAccountInventory.DataSource = dtList.DefaultView; cboChartOfAccountInventory.DataBind(); cboChartOfAccountInventory.Items.Add(new ListItem("Not Applicable", "0")); cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.Count - 1; cboChartOfAccountIDTaxPurchase.DataTextField = "ChartOfAccountNameComplete"; cboChartOfAccountIDTaxPurchase.DataValueField = "ChartOfAccountID"; cboChartOfAccountIDTaxPurchase.DataSource = dtList.DefaultView; cboChartOfAccountIDTaxPurchase.DataBind(); cboChartOfAccountIDTaxPurchase.Items.Add(new ListItem("Not Applicable", "0")); cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.Count - 1; cboChartOfAccountIDTaxSold.DataTextField = "ChartOfAccountNameComplete"; cboChartOfAccountIDTaxSold.DataValueField = "ChartOfAccountID"; cboChartOfAccountIDTaxSold.DataSource = dtList.DefaultView; cboChartOfAccountIDTaxSold.DataBind(); cboChartOfAccountIDTaxSold.Items.Add(new ListItem("Not Applicable", "0")); cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.Count - 1; }
private void LoadProductSubGroups(System.Data.SqlClient.SortOrder SequenceSortOrder) { try { tblLayoutGroup.Controls.Clear(); if (mboLocked) return; Int64 intSequenceNoStart = 0; if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending) try { intSequenceNoStart = long.Parse(cmdSubGroupLeft.Tag.ToString()); } catch { } else try { intSequenceNoStart = long.Parse(cmdSubGroupRight.Tag.ToString()); } catch { } // Sep 24, 2014 put an override if cmdSubGroupLeft.Tag = 0 // always do an asceding coz its already the end. if (intSequenceNoStart < Constants.C_RESTOPLUS_MAX_SUB_GROUP) intSequenceNoStart = 0; //reset to 0 if it's 1 if (intSequenceNoStart == 0) SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending; ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns(); clsProductSubGroupColumns.ProductSubGroupCode = true; clsProductSubGroupColumns.SequenceNo = true; ProductSubGroup clsProductSubGroup = new ProductSubGroup(mConnection, mTransaction); System.Data.DataTable dtProductSubGroup = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, new ProductSubGroupDetails(), intSequenceNoStart, SequenceSortOrder, "SequenceNo", SequenceSortOrder, SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending ? Constants.C_RESTOPLUS_MAX_SUB_GROUP : Constants.C_RESTOPLUS_MAX_SUB_GROUP + 1); clsProductSubGroup.CommitAndDispose(); // re-order the products by sequence no if (dtProductSubGroup.Rows.Count > 0) { System.Data.DataView dv = dtProductSubGroup.DefaultView; dv.Sort = "SequenceNo"; dtProductSubGroup = dv.ToTable(); } int iRow = 0; int iCol = 0; int iCtr = 1; if (dtProductSubGroup.Rows.Count == 0) { cmdSubGroupLeft.Tag = "0".ToString(); // reset the sequenceno to 0 if no record cmdSubGroupRight.Tag = "0".ToString(); // reset the sequenceno to 0 if no record } foreach (System.Data.DataRow dr in dtProductSubGroup.Rows) { if (iCtr > Constants.C_RESTOPLUS_MAX_SUB_GROUP) break; if (iCtr == 1) cmdSubGroupLeft.Tag = dr[Data.ProductSubGroupColumnNames.SequenceNo].ToString(); if (iCtr >= 1 && dtProductSubGroup.Rows.Count > Constants.C_RESTOPLUS_MAX_SUB_GROUP) cmdSubGroupRight.Tag = dr[Data.ProductSubGroupColumnNames.SequenceNo].ToString(); SubGroupButton cmdSubGroup = new SubGroupButton(); cmdSubGroup.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; cmdSubGroup.BackColor = System.Drawing.Color.Red; cmdSubGroup.Dock = System.Windows.Forms.DockStyle.Fill; cmdSubGroup.FlatAppearance.BorderColor = System.Drawing.Color.Gold; cmdSubGroup.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); cmdSubGroup.ForeColor = System.Drawing.SystemColors.ControlText; cmdSubGroup.GradientBottom = System.Drawing.Color.Red; cmdSubGroup.GradientTop = System.Drawing.Color.Gold; cmdSubGroup.ImageAlign = System.Drawing.ContentAlignment.TopCenter; cmdSubGroup.Location = new System.Drawing.Point(3, 3); cmdSubGroup.Size = new System.Drawing.Size(110, 82); cmdSubGroup.TabIndex = iCtr-1; cmdSubGroup.TextAlign = System.Drawing.ContentAlignment.BottomCenter; cmdSubGroup.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; cmdSubGroup.UseVisualStyleBackColor = false; cmdSubGroup.Name = "cmdSubGroup" + iCtr.ToString(); cmdSubGroup.Text = dr[Data.ProductSubGroupColumnNames.ProductSubGroupCode].ToString(); cmdSubGroup.Tag = dr[Data.ProductSubGroupColumnNames.ProductSubGroupID].ToString(); cmdSubGroup.Click += new System.EventHandler(cmdSubGroup_Click); if (!string.IsNullOrEmpty(dr[Data.ProductSubGroupColumnNames.ImagePath].ToString())) { try { cmdSubGroup.Image = new Bitmap(Application.StartupPath + "/images/subgroups/" + dr[Data.ProductSubGroupColumnNames.ImagePath].ToString()); } catch { } } tblLayoutGroup.Controls.Add(cmdSubGroup, iCol, iRow); iCol++; iCtr++; } } catch { } }
protected void cboProductSubGroup_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboProductSubGroup.Items.Count != 0) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(cboProductSubGroup.SelectedItem.Value)); cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf( cboProductUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0"); txtWSPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductSubGroupDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsProductSubGroupDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0"); clsProductSubGroup.CommitAndDispose(); } }
protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e) { ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductGroupID = Int64.Parse(cboProductGroup.SelectedItem.Value) } ; ProductSubGroup clsProductSubGroup = new ProductSubGroup(); cboProductSubGroup.DataTextField = "ProductSubGroupName"; cboProductSubGroup.DataValueField = "ProductSubGroupID"; cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView; cboProductSubGroup.DataBind(); cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1; clsProductSubGroup.CommitAndDispose(); cboProductSubGroup_SelectedIndexChanged(null, null); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblSubGroupID.Text = Common.Decrypt((string)Request.QueryString["subgroupid"],Session.SessionID); ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations(); lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariation.List(Convert.ToInt32(lblSubGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView; lstItem.DataBind(); clsProductSubGroupVariation.CommitAndDispose(); Data.Unit clsUnit = new Data.Unit(); cboUnit.DataTextField = "UnitName"; cboUnit.DataValueField = "UnitID"; cboUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView; cboUnit.DataBind(); cboUnit.SelectedIndex = cboUnit.Items.Count - 1; clsUnit.CommitAndDispose(); ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(lblSubGroupID.Text)); clsProductSubGroup.CommitAndDispose(); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0"); txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductSubGroupDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsProductSubGroupDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0"); }
protected void imgProductSubGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e) { ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductSubGroupName = txtProductSubGroup.Text }; ProductSubGroup clsProductSubGroup = new ProductSubGroup(); cboProductSubGroup.DataTextField = "ProductSubGroupName"; cboProductSubGroup.DataValueField = "ProductSubGroupID"; cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView; cboProductSubGroup.DataBind(); cboProductSubGroup.SelectedIndex = 0; cboProductSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); if (cboProductSubGroup.Items.Count > 1 && txtProductSubGroup.Text.Trim() != string.Empty) cboProductSubGroup.SelectedIndex = 1; else cboProductSubGroup.SelectedIndex = 0; clsProductSubGroup.CommitAndDispose(); }
private void Upload() { if( ( txtPath.PostedFile != null ) && ( txtPath.PostedFile.ContentLength > 0 ) ) { string fn = System.IO.Path.GetFileName(txtPath.PostedFile.FileName); string SaveLocation = "/RetailPlus/temp/uploaded_" + fn; txtPath.PostedFile.SaveAs(SaveLocation); XmlTextReader reader = new XmlTextReader(SaveLocation); reader.WhitespaceHandling = WhitespaceHandling.None; Stock clsStock = new Stock(); clsStock.GetConnection(); string strStockTransactionNo = null; long StockID = 0; long ContactID = 0; int UnitID = 0; long ProductGroupID = 0; long ProductSubGroupID = 0; long ProductID = 0; long ProductBaseMatrixID = 0; VariationDetails clsVariationDetails; int VariationID = 0; StockItemDetails clsStockItemDetails = new StockItemDetails(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name == "Stock") { strStockTransactionNo = reader.GetAttribute("TransactionNo"); StockID = clsStock.Details(reader.GetAttribute("TransactionNo")).StockID; if (StockID > 0) { clsStock.CommitAndDispose(); Label1.Text = "<b>This file has already been added to inventory.<br />"; Label1.Text += "Please refer to transaction No: " + strStockTransactionNo + ".</b>"; reader.Close(); return; } Contacts clsContact = new Contacts(clsStock.Connection, clsStock.Transaction); ContactID = clsContact.Details(reader.GetAttribute("ContactCode")).ContactID; if (ContactID == 0) { ContactDetails clsContactDetails = new ContactDetails(); clsContactDetails.ContactCode = reader.GetAttribute("ContactCode"); clsContactDetails.ContactName = reader.GetAttribute("ContactName"); clsContactDetails.ContactGroupID = Convert.ToInt32(reader.GetAttribute("ContactGroupID")); clsContactDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), reader.GetAttribute("ModeOfTerms")); clsContactDetails.Terms = Convert.ToInt32(reader.GetAttribute("Terms")); clsContactDetails.Address = reader.GetAttribute("Address"); clsContactDetails.BusinessName = reader.GetAttribute("BusinessName"); clsContactDetails.TelephoneNo = reader.GetAttribute("TelephoneNo"); clsContactDetails.Remarks = reader.GetAttribute("Remarks"); clsContactDetails.Debit = Convert.ToDecimal(reader.GetAttribute("Debit")); clsContactDetails.Credit = Convert.ToDecimal(reader.GetAttribute("Credit")); clsContactDetails.IsCreditAllowed = Convert.ToBoolean(reader.GetAttribute("IsCreditAllowed")); clsContactDetails.CreditLimit = Convert.ToDecimal(reader.GetAttribute("CreditLimit")); ContactID = clsContact.Insert(clsContactDetails); } StockDetails clsStockDetails = new StockDetails(); clsStockDetails.TransactionNo = reader.GetAttribute("TransactionNo"); clsStockDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID); clsStockDetails.StockDate = DateTime.Now; clsStockDetails.SupplierID = ContactID; clsStockDetails.Remarks = reader.GetAttribute("StockRemarks") + Environment.NewLine + "Original Stock Date: " + reader.GetAttribute("StockDate"); StockItemDetails[] itemDetails = new StockItemDetails[0]; clsStockDetails.StockItems = itemDetails; StockID = clsStock.Insert(clsStockDetails); } else if (reader.Name == "Item") { Data.Unit clsUnit = new Data.Unit(clsStock.Connection, clsStock.Transaction); UnitID = clsUnit.Details(reader.GetAttribute("ProductUnitCode")).UnitID; if (UnitID == 0) { UnitDetails clsUnitDetails = new UnitDetails(); clsUnitDetails.UnitCode = reader.GetAttribute("ProductUnitCode"); clsUnitDetails.UnitName = reader.GetAttribute("ProductUnitName"); UnitID = clsUnit.Insert(clsUnitDetails); } ProductGroup clsProductGroup = new ProductGroup(clsStock.Connection, clsStock.Transaction); ProductGroupID = clsProductGroup.Details(reader.GetAttribute("ProductGroupCode")).ProductGroupID; if (ProductGroupID == 0) { Label1.Text += "inserting product group...."; ProductGroupDetails clsProductGroupDetails = new ProductGroupDetails(); clsProductGroupDetails.ProductGroupCode = reader.GetAttribute("ProductGroupCode"); clsProductGroupDetails.ProductGroupName = reader.GetAttribute("ProductGroupName"); clsProductGroupDetails.UnitDetails = new UnitDetails { UnitID = UnitID }; clsProductGroupDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price")); clsProductGroupDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice")); clsProductGroupDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount")); clsProductGroupDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT")); clsProductGroupDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT")); clsProductGroupDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax")); ProductGroupID = clsProductGroup.Insert(clsProductGroupDetails); } ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsStock.Connection, clsStock.Transaction); ProductSubGroupID = clsProductSubGroup.Details(reader.GetAttribute("ProductSubGroupCode")).ProductSubGroupID; if (ProductSubGroupID == 0) { Label1.Text += "inserting product sub-group...."; ProductSubGroupDetails clsProductSubGroupDetails = new ProductSubGroupDetails(); clsProductSubGroupDetails.ProductGroupID = ProductGroupID; clsProductSubGroupDetails.ProductSubGroupCode = reader.GetAttribute("ProductSubGroupCode"); clsProductSubGroupDetails.ProductSubGroupName = reader.GetAttribute("ProductSubGroupName"); clsProductSubGroupDetails.BaseUnitID = UnitID; clsProductSubGroupDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price")); clsProductSubGroupDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice")); clsProductSubGroupDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount")); clsProductSubGroupDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT")); clsProductSubGroupDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT")); clsProductSubGroupDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax")); ProductSubGroupID = clsProductSubGroup.Insert(clsProductSubGroupDetails); } Products clsProduct = new Products(clsStock.Connection, clsStock.Transaction); ProductID = clsProduct.Details(reader.GetAttribute("BarCode")).ProductID; if (ProductID == 0) { Label1.Text += "inserting product...."; ProductDetails clsProductDetails = new ProductDetails(); clsProductDetails.ProductCode = reader.GetAttribute("ProductCode"); clsProductDetails.BarCode = reader.GetAttribute("BarCode"); clsProductDetails.ProductDesc = reader.GetAttribute("ProductDesc"); clsProductDetails.ProductGroupID = ProductGroupID; clsProductDetails.ProductSubGroupID = ProductSubGroupID; clsProductDetails.ProductDesc = reader.GetAttribute("ProductDesc"); clsProductDetails.BaseUnitID = UnitID; clsProductDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price")); clsProductDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice")); clsProductDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount")); clsProductDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT")); clsProductDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT")); clsProductDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax")); clsProductDetails.Quantity = 0; clsProductDetails.MinThreshold = Convert.ToDecimal(reader.GetAttribute("MinThreshold")); clsProductDetails.MaxThreshold = Convert.ToDecimal(reader.GetAttribute("MaxThreshold")); clsProductDetails.SupplierID = Contacts.DEFAULT_SUPPLIER_ID; ProductID = clsProduct.Insert(clsProductDetails); } //ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsStock.Connection, clsStock.Transaction); //ProductBaseMatrixID = clsProductVariationsMatrix.BaseDetails(0, 0, ProductID, reader["ItemBaseVariationDescription"].ToString()).MatrixID; //if (ProductBaseMatrixID == 0) //{ // ProductBaseMatrixDetails clsBaseDetails = new ProductBaseMatrixDetails(); // clsBaseDetails.ProductID = ProductID; // clsBaseDetails.Description = reader.GetAttribute("ItemBaseVariationDescription"); // clsBaseDetails.UnitID = UnitID; // clsBaseDetails.Price = Convert.ToDecimal(reader.GetAttribute("Price")); // clsBaseDetails.PurchasePrice = Convert.ToDecimal(reader.GetAttribute("PurchasePrice")); // clsBaseDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(reader.GetAttribute("IncludeInSubtotalDiscount")); // clsBaseDetails.Quantity = 0; // clsBaseDetails.VAT = Convert.ToDecimal(reader.GetAttribute("VAT")); // clsBaseDetails.EVAT = Convert.ToDecimal(reader.GetAttribute("EVAT")); // clsBaseDetails.LocalTax = Convert.ToDecimal(reader.GetAttribute("LocalTax")); // clsBaseDetails.MinThreshold = Convert.ToDecimal(reader.GetAttribute("MinThreshold")); // clsBaseDetails.MaxThreshold = Convert.ToDecimal(reader.GetAttribute("MaxThreshold")); // ProductBaseMatrixID = clsProductVariationsMatrix.InsertBaseVariation(clsBaseDetails); // clsBaseDetails.MatrixID = ProductBaseMatrixID; //} clsStockItemDetails = new StockItemDetails(); clsStockItemDetails.StockID = StockID; clsStockItemDetails.ProductID = ProductID; clsStockItemDetails.VariationMatrixID = ProductBaseMatrixID; clsStockItemDetails.ProductUnitID = UnitID; clsStockItemDetails.StockTypeID = Convert.ToInt16(Constants.STOCK_TYPE_TRANSFER_FROM_BRANCH_ID); clsStockItemDetails.StockDate = DateTime.Now; clsStockItemDetails.Quantity = Convert.ToDecimal(reader.GetAttribute("ItemQuantity")); clsStockItemDetails.Remarks = reader.GetAttribute("ItemRemarks"); Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"]; clsStock.AddItem(Constants.BRANCH_ID_MAIN, strStockTransactionNo, clsAccessUserDetails.Name, clsStockItemDetails, StockDirections.Increment); } else if (reader.Name == "Variation" && reader.GetAttribute("VariationCode") != null) { Variation clsVariation = new Variation(clsStock.Connection, clsStock.Transaction); VariationID = clsVariation.Details(reader.GetAttribute("VariationCode")).VariationID; if (VariationID == 0 ) { clsVariationDetails = new VariationDetails(); clsVariationDetails.VariationCode = reader.GetAttribute("VariationCode"); clsVariationDetails.VariationType = reader.GetAttribute("VariationType"); VariationID = clsVariation.Insert(clsVariationDetails); } ProductVariationDetails clsProductVariationDetails = new ProductVariationDetails(); clsProductVariationDetails.ProductID = ProductID; clsProductVariationDetails.VariationID = VariationID; ProductVariations clsProductVariation = new ProductVariations(clsStock.Connection, clsStock.Transaction); if (clsProductVariation.isExist(clsProductVariationDetails) == false) { long ProductVariationID = clsProductVariation.Insert(clsProductVariationDetails); } } else if (reader.Name == "VariationMatrix" && reader.GetAttribute("VariationCode") != null) { Variation clsVariation = new Variation(clsStock.Connection, clsStock.Transaction); VariationID = clsVariation.Details(reader.GetAttribute("VariationCode")).VariationID; if (VariationID == 0) { clsVariationDetails = new VariationDetails(); clsVariationDetails.VariationCode = reader.GetAttribute("VariationCode"); clsVariationDetails.VariationType = reader.GetAttribute("VariationType"); VariationID = clsVariation.Insert(clsVariationDetails); } ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(clsStock.Connection, clsStock.Transaction); if (clsProductVariationsMatrix.isExist(ProductBaseMatrixID, VariationID) == false) { ProductVariationsMatrixDetails clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails(); clsProductVariationsMatrixDetails.ProductID = ProductID; clsProductVariationsMatrixDetails.MatrixID = ProductBaseMatrixID; clsProductVariationsMatrixDetails.VariationID = VariationID; clsProductVariationsMatrixDetails.Description = reader.GetAttribute("Description"); clsProductVariationsMatrix.SaveVariation(clsProductVariationsMatrixDetails); } } else { Label1.Text = "<b>Reader Name:<b>" + reader.Name + "<br />"; } break; case XmlNodeType.Text: Label1.Text = "<b>" + reader.LocalName + ":<b>" + reader.Value + "<br />"; break; } } reader.Close(); clsStock.CommitAndDispose(); Label1.Text = "<b>Transaction No.: " + strStockTransactionNo + " has been successfully transferred.<br />"; } else { Response.Write("Please select a file to upload."); } }
private void LoadSubGroup() { ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails(); clsSearchKeys.ProductSubGroupCode = txtProductSubGroup.Text; clsSearchKeys.ProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value); ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsProductSubGroup = new ProductSubGroup(); cboProductSubGroup.DataTextField = "ProductSubGroupName"; cboProductSubGroup.DataValueField = "ProductSubGroupID"; cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboProductSubGroup.DataBind(); clsProductSubGroup.CommitAndDispose(); if (cboProductSubGroup.Items.Count == 0) cboProductSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING)); cboProductSubGroup.SelectedIndex = 0; }
private void LoadList() { string SortField = "SequenceNo ASC, ProductSubGroupCode"; 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 = string.Empty; if (Request.QueryString["Search"] != null) { SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); } else if (Session["Search"] != null) { SearchKey = Common.Decrypt(Session["Search"].ToString(), Session.SessionID); } try { Session.Remove("Search"); } catch { } if (SearchKey == null) { SearchKey = string.Empty; } else if (SearchKey != string.Empty) { Session.Add("Search", Common.Encrypt(SearchKey, Session.SessionID)); } ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsAll = true }; ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails(); clsSearchKeys.ProductGroupDetails = new ProductGroupDetails() { ProductGroupCode = SearchKey, ProductGroupName = SearchKey }; clsSearchKeys.ProductSubGroupCode = SearchKey; clsSearchKeys.ProductSubGroupName = SearchKey; ProductSubGroup clsProductSubGroup = new ProductSubGroup(); System.Data.DataTable dt = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: SortField, SortOrder: (sortoption == SortOption.Ascending ? System.Data.SqlClient.SortOrder.Ascending : System.Data.SqlClient.SortOrder.Descending)); clsProductSubGroup.CommitAndDispose(); PageData.DataSource = dt.DefaultView; 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 SaveRecord() { ProductSubGroupDetails clsDetails = new ProductSubGroupDetails(); clsDetails.ProductSubGroupID = Convert.ToInt16(lblProductSubGroupID.Text); clsDetails.ProductGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); clsDetails.ProductSubGroupCode = txtProductSubGroupCode.Text; clsDetails.ProductSubGroupName = txtProductSubGroupName.Text; clsDetails.BaseUnitID = Convert.ToInt32(cboProductSubGroupUnit.SelectedItem.Value); clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked; clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); ProductSubGroup clsProductSubGroup = new ProductSubGroup(); clsProductSubGroup.Update(clsDetails); clsProductSubGroup.CommitAndDispose(); }
protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { HtmlInputCheckBox chkList = null; string stParam = string.Empty; chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&subgroupid=" + Common.Encrypt(chkList.Value, Session.SessionID); switch (e.CommandName) { case "imgItemDelete": ProductSubGroup clsProductSubGroup = new ProductSubGroup(); clsProductSubGroup.Delete(chkList.Value); clsProductSubGroup.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; case "imgVariationsClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_Variations/Default.aspx" + stParam); break; case "imgVariationsMatrixClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_VariationsMatrix/Default.aspx" + stParam); break; case "imgUnitsMatrixClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_UnitsMatrix/Default.aspx" + stParam); break; } }
private Int64 SaveRecord() { ProductSubGroupDetails clsDetails = new ProductSubGroupDetails(); clsDetails.ProductGroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); clsDetails.ProductSubGroupCode = txtProductSubGroupCode.Text; clsDetails.ProductSubGroupName = txtProductSubGroupName.Text; clsDetails.BaseUnitID = Convert.ToInt32(cboProductSubGroupUnit.SelectedItem.Value); clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(chkIncludeInSubtotalDiscount.Checked); clsDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); clsDetails.SequenceNo = Int32.Parse(txtSequenceNo.Text); clsDetails.ImagePath = lblImagePath.Text; string strfile = ""; string strfolder = "/RetailPlus/temp/uploaded/subgroupimages/"; for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFile pfile = Request.Files[i]; if (pfile.ContentLength > 0) { strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(pfile.FileName)); if (!System.IO.Directory.Exists(Server.MapPath(strfolder))) System.IO.Directory.CreateDirectory(Server.MapPath(strfolder)); if (System.IO.File.Exists(strfile)) System.IO.File.Delete(strfile); pfile.SaveAs(strfile); clsDetails.ImagePath = pfile.FileName; } } ProductSubGroup clsProductSubGroup = new ProductSubGroup(); Int64 id = clsProductSubGroup.Insert(clsDetails); clsDetails.ProductSubGroupID = id; if (chkVariations.Checked == true) { clsProductSubGroup.InheritGroupVariations(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID); } if (chkVariationsMatrix.Checked == true) { if (chkVariations.Checked == false) { clsProductSubGroup.InheritGroupVariations(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID); } clsProductSubGroup.InheritGroupVariationsMatrix(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID); } if (chkUnitMatrix.Checked == true) { clsProductSubGroup.InheritGroupUnitMatrix(clsDetails.ProductGroupID, clsDetails.ProductSubGroupID); } clsProductSubGroup.CommitAndDispose(); return id; }
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) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); clsProductSubGroup.Delete( stIDs.Substring(0,stIDs.Length-1)); clsProductSubGroup.CommitAndDispose(); } return boRetValue; }
protected void cboGroup_SelectedIndexChanged(object sender, EventArgs e) { ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails(); clsSearchKeys.ProductGroupID = long.Parse(cboGroup.SelectedItem.Value); ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true }; ProductSubGroup clsProductSubGroup = new ProductSubGroup(); cboSubGroup.DataTextField = "ProductSubGroupName"; cboSubGroup.DataValueField = "ProductSubGroupID"; cboSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending); cboSubGroup.DataBind(); if (cboGroup.SelectedItem.Value != Constants.ZERO_STRING) cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL + " " + cboGroup.SelectedItem.Text, Constants.ZERO_STRING)); else cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING)); cboSubGroup.SelectedIndex = 0; clsProductSubGroup.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); int subgroupid = Convert.ToInt32(Common.Decrypt(Request.QueryString["subgroupid"].ToString(),Session.SessionID)); lblSubGroupID.Text = Convert.ToString(subgroupid); ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix(); ProductSubGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(subgroupid); if (clsUnitDetails.BottomUnitName == null) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsDetails = clsProductSubGroup.Details(subgroupid); clsProductSubGroup.CommitAndDispose(); txtBaseUnit.Text = clsDetails.BaseUnitName; lblBaseUnitID.Text = Convert.ToString(clsDetails.BaseUnitID); } else { txtBaseUnit.Text = clsUnitDetails.BottomUnitName; lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID); } cboBottomUnit.DataTextField = "UnitName"; cboBottomUnit.DataValueField = "UnitID"; cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(subgroupid,"UnitName",SortOption.Ascending)).DefaultView; cboBottomUnit.DataBind(); if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text))) { cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text))); } cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1; clsUnitMatrix.CommitAndDispose(); }
protected void cboProductSubGroup_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboProductSubGroup.Items.Count != 0) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(cboProductSubGroup.SelectedItem.Value)); cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf( cboProductUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString())); txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0"); clsProductSubGroup.CommitAndDispose(); } }