private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["soid"], Session.SessionID)); SO clsSO = new SO(); SODetails clsDetails = clsSO.Details(iID); clsSO.CommitAndDispose(); lblSOID.Text = clsDetails.SOID.ToString(); lblSONo.Text = clsDetails.SONo; lblSODate.Text = clsDetails.SODate.ToString("yyyy-MM-dd HH:mm:ss"); txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); cboCustomer.SelectedIndex = cboCustomer.Items.IndexOf(cboCustomer.Items.FindByValue(clsDetails.CustomerID.ToString())); txtCustomerContact.Text = clsDetails.CustomerContact; txtCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo; lblTerms.Text = clsDetails.CustomerTerms.ToString("##0"); switch (clsDetails.CustomerModeOfTerms) { case 0: lblModeOfterms.Text = "Days"; break; case 1: lblModeOfterms.Text = "Months"; break; case 2: lblModeOfterms.Text = "Years"; break; } txtCustomerAddress.Text = clsDetails.CustomerAddress; cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString())); txtBranchAddress.Text = clsDetails.BranchAddress; txtRemarks.Text = clsDetails.Remarks; }
private void SaveRecord() { SODetails clsDetails = new SODetails(); clsDetails.SOID = Convert.ToInt64(lblSOID.Text); clsDetails.SONo = lblSONo.Text; clsDetails.SODate = Convert.ToDateTime(lblSODate.Text); clsDetails.CustomerID = Convert.ToInt64(cboCustomer.SelectedItem.Value); clsDetails.CustomerCode = cboCustomer.SelectedItem.Text; clsDetails.CustomerContact = txtCustomerContact.Text; clsDetails.CustomerAddress = txtCustomerAddress.Text; clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text; switch (lblModeOfterms.Text) { case "Days": clsDetails.CustomerModeOfTerms = 0; break; case "Months": clsDetails.CustomerModeOfTerms = 1; break; case "Years": clsDetails.CustomerModeOfTerms = 2; break; } clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value); clsDetails.SellerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.SellerName = Session["Name"].ToString(); clsDetails.Status = SOStatus.Open; clsDetails.Remarks = txtRemarks.Text; SO clsSO = new SO(); clsSO.Update(clsDetails); clsSO.CommitAndDispose(); }
private void UpdateSODiscount() { SODetails clsSODetails = new SODetails(); clsSODetails.SOID = Convert.ToInt64(lblSOID.Text); clsSODetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text); clsSODetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value); SO clsSO = new SO(); clsSO.UpdateDiscount(clsSODetails.SOID, clsSODetails.DiscountApplied, clsSODetails.DiscountType); clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text)); clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text)); clsSO.CommitAndDispose(); UpdateFooter(clsSODetails); }
private void UpdateDeposit() { SODetails clsSODetails = new SODetails(); clsSODetails.SOID = Convert.ToInt64(lblSOID.Text); clsSODetails.Deposit = Convert.ToDecimal(txtSODeposit.Text); SO clsSO = new SO(); clsSO.UpdateDeposit(clsSODetails.SOID, clsSODetails.Deposit); clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text)); clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text)); clsSO.CommitAndDispose(); UpdateFooter(clsSODetails); }
private void IssueGRN() { DateTime DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); clsERPConfig.CommitAndDispose(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { long SOID = Convert.ToInt64(lblSOID.Text); string CustomerDRNo = txtCustomerDRNo.Text; SO clsSO = new SO(); clsSO.IssueGRN(SOID, CustomerDRNo, DeliveryDate); clsSO.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&soid=" + Common.Encrypt(SOID.ToString(), Session.SessionID); Response.Redirect("Default.aspx" + stParam); } else { string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot post using the delivery date: " + txtDeliveryDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } }
private void GenerateItems() { SO clsSO = new SO(); clsSO.GenerateItemsForReorder(Int32.Parse(Session["TerminalID"].ToString()), Convert.ToInt64(lblSOID.Text)); clsSO.CommitAndDispose(); }
private void SetDataSource(ReportDocument Report) { long iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["soid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["soid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["soid"].ToString(), Session.SessionID)); } lblReferrer.ToolTip = iID.ToString(); } catch { iID = long.Parse(lblReferrer.ToolTip); } ReportDataset rptds = new ReportDataset(); SO clsSO = new SO(); MySqlDataReader myreader = clsSO.List(iID, "SOID", SortOption.Ascending); while (myreader.Read()) { DataRow drNew = rptds.SO.NewRow(); foreach (DataColumn dc in rptds.SO.Columns) drNew[dc] = "" + myreader[dc.ColumnName]; rptds.SO.Rows.Add(drNew); } myreader.Close(); SOItem clsSOItem = new SOItem(clsSO.Connection, clsSO.Transaction); System.Data.DataTable dt = clsSOItem.ListAsDataTable(iID); foreach(System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.SOItems.NewRow(); foreach (DataColumn dc in rptds.SOItems.Columns) drNew[dc] = "" + dr[dc.ColumnName]; rptds.SOItems.Rows.Add(drNew); } clsSO.CommitAndDispose(); Report.SetDataSource(rptds); SetParameters(Report); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["soid"], Session.SessionID)); SO clsSO = new SO(); SODetails clsDetails = clsSO.Details(iID); clsSO.CommitAndDispose(); lblSOID.Text = clsDetails.SOID.ToString(); lnkSONo.Text = clsDetails.SONo; lnkSONo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&soid=" + Common.Encrypt(clsDetails.SOID.ToString(), Session.SessionID); lblSODate.Text = clsDetails.SODate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblCustomerID.Text = clsDetails.CustomerID.ToString(); lblCustomerCode.Text = clsDetails.CustomerCode.ToString(); lblCustomerCode.NavigateUrl = "../_Customer/Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.CustomerID.ToString(), Session.SessionID); lblCustomerContact.Text = clsDetails.CustomerContact; lblCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo; lblTerms.Text = clsDetails.CustomerTerms.ToString("##0"); switch (clsDetails.CustomerModeOfTerms) { case 0: lblModeOfterms.Text = "Days"; break; case 1: lblModeOfterms.Text = "Months"; break; case 2: lblModeOfterms.Text = "Years"; break; } lblCustomerAddress.Text = clsDetails.CustomerAddress; lblBranchID.Text = clsDetails.BranchID.ToString(); lblBranchCode.Text = clsDetails.BranchCode; lblBranchAddress.Text = clsDetails.BranchAddress; lblSORemarks.Text = clsDetails.Remarks; txtSODiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboSODiscountType.SelectedIndex = cboSODiscountType.Items.IndexOf(cboSODiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblSODiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblSOVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtSOFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtSODeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblSOSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0"); lblSOVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblSOTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["poid"],Session.SessionID)); SO clsSO = new SO(); SODetails clsDetails = clsSO.Details(iID); clsSO.CommitAndDispose(); lblSOID.Text = clsDetails.SOID.ToString(); lblSONo.Text = clsDetails.SONo; lblSODate.Text = clsDetails.SODate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblCustomerID.Text = clsDetails.CustomerID.ToString(); lblCustomerCode.Text = clsDetails.CustomerCode.ToString(); string stParam = "?task=" + Common.Encrypt("details",Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.CustomerID.ToString(),Session.SessionID); lblCustomerCode.NavigateUrl = "/RetailPlus/SalesAndReceivables/_Vendor/Default.aspx" + stParam; lblCustomerContact.Text = clsDetails.CustomerContact; lblCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo; lblTerms.Text = clsDetails.CustomerTerms.ToString("##0"); switch (clsDetails.CustomerModeOfTerms) { case 0: lblModeOfterms.Text = "Days"; break; case 1: lblModeOfterms.Text = "Months"; break; case 2: lblModeOfterms.Text = "Years"; break; } lblCustomerAddress.Text = clsDetails.CustomerAddress; lblBranchID.Text = clsDetails.BranchID.ToString(); lblBranchCode.Text = clsDetails.BranchCode; lblBranchAddress.Text = clsDetails.BranchAddress; lblSORemarks.Text = clsDetails.Remarks; lblSOSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0"); lblSOVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblSOTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); }
private void LoadList() { SO clsSO = new SO(); string SortField = "SOID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } if (Request.QueryString["Search"] == null) { if (Request.QueryString["status"] == null) { PageData.DataSource = clsSO.ListAsDataTable(SOStatus.Open, SortField, sortoption).DefaultView; } else { SOStatus status = (SOStatus)Enum.Parse(typeof(SOStatus), Common.Decrypt((string)Request.QueryString["status"], Session.SessionID)); PageData.DataSource = clsSO.ListAsDataTable(status, SortField, sortoption).DefaultView; } } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); if (Request.QueryString["status"] == null) { PageData.DataSource = clsSO.SearchAsDataTable(SOStatus.Open, SearchKey, SortField, sortoption).DefaultView; } else { SOStatus status = (SOStatus)Enum.Parse(typeof(SOStatus), Common.Decrypt((string)Request.QueryString["status"], Session.SessionID)); PageData.DataSource = clsSO.SearchAsDataTable(status, SearchKey, SortField, sortoption).DefaultView; } } clsSO.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 Int64 SaveRecord() { SO clsSO = new SO(); clsSO.GetConnection(); lblSONo.Text = Constants.SALES_ORDER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsSO.LastTransactionNo(); SODetails clsDetails = new SODetails(); clsDetails.SONo = lblSONo.Text; clsDetails.SODate = Convert.ToDateTime(lblSODate.Text); clsDetails.CustomerID = Convert.ToInt64(cboCustomer.SelectedItem.Value); clsDetails.CustomerCode = cboCustomer.SelectedItem.Text; clsDetails.CustomerContact = txtCustomerContact.Text; clsDetails.CustomerAddress = txtCustomerAddress.Text; clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text; clsDetails.CustomerTerms = Convert.ToInt32(lblTerms.Text); switch (lblModeOfterms.Text) { case "Days": clsDetails.CustomerModeOfTerms = 0; break; case "Months": clsDetails.CustomerModeOfTerms = 1; break; case "Years": clsDetails.CustomerModeOfTerms = 2; break; } clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value); clsDetails.SellerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.SellerName = Session["Name"].ToString(); clsDetails.Status = SOStatus.Open; clsDetails.Remarks = txtRemarks.Text; Int64 id = clsSO.Insert(clsDetails); clsSO.CommitAndDispose(); return id; }
private void CancelSO() { long SOID = Convert.ToInt64(lblSOID.Text); string Remarks = txtRemarks.Text; SO clsSO = new SO(); clsSO.Cancel(SOID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString())); clsSO.CommitAndDispose(); Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID)); }
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) { SO clsSO = new SO(); clsSO.Delete( stIDs.Substring(0,stIDs.Length-1)); clsSO.CommitAndDispose(); } return boRetValue; }