private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID)); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); WBranchTransferDetails clsDetails = clsWBranchTransfer.Details(iID); clsWBranchTransfer.CommitAndDispose(); lblWBranchTransferID.Text = clsDetails.WBranchTransferID.ToString(); lblWBranchTransferNo.Text = clsDetails.WBranchTransferNo; lblWBranchTransferDate.Text = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss"); txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); cboBranchFrom.SelectedIndex = cboBranchFrom.Items.IndexOf(cboBranchFrom.Items.FindByValue(clsDetails.BranchIDFrom.ToString())); cboBranchTo.SelectedIndex = cboBranchTo.Items.IndexOf(cboBranchTo.Items.FindByValue(clsDetails.BranchIDTo.ToString())); txtRequestedBy.Text = clsDetails.RequestedBy; txtRemarks.Text = clsDetails.Remarks; }
private void LoadList() { WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); DataClass clsDataClass = new DataClass(); Common Common = new Common(); string SortField = "WBranchTransferID"; 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); } DateTime dteTransferStartDate = DateTime.MinValue; try { if (txtTransferStartDate.Text != string.Empty) dteTransferStartDate = Convert.ToDateTime(txtTransferStartDate.Text + " " + txtTransferStartTime.Text); } catch { } DateTime dteTransferEndDate = DateTime.MinValue; try { if (txtTransferEndDate.Text != string.Empty) dteTransferEndDate = Convert.ToDateTime(txtTransferEndDate.Text + " " + txtTransferEndTime.Text); } catch { } DateTime dtePostingStartDate = DateTime.MinValue; try { if (txtPostingStartDate.Text != string.Empty) dtePostingStartDate = Convert.ToDateTime(txtPostingStartDate.Text + " " + txtPostingStartTime.Text); } catch { } DateTime dtePostingEndDate = DateTime.MinValue; try { if (txtPostingEndDate.Text != string.Empty) dtePostingEndDate = Convert.ToDateTime(txtPostingEndDate.Text + " " + txtPostingEndTime.Text); } catch { } WBranchTransferDetails searchKey = new WBranchTransferDetails(); searchKey.WBranchTransferNo = txtSearch.Text; WBranchTransferStatus status = (WBranchTransferStatus)Enum.Parse(typeof(WBranchTransferStatus), cboStatus.SelectedItem.Value); PageData.DataSource = clsWBranchTransfer.ListAsDataTable(0, 0, searchKey, status, dteTransferStartDate, dteTransferEndDate, dtePostingStartDate, dtePostingEndDate, null, null, SortField, sortoption).DefaultView; clsWBranchTransfer.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 SaveRecord() { WBranchTransferDetails clsDetails = new WBranchTransferDetails(); clsDetails.WBranchTransferID = long.Parse(lblWBranchTransferID.Text); clsDetails.WBranchTransferNo = lblWBranchTransferNo.Text; clsDetails.WBranchTransferDate = Convert.ToDateTime(lblWBranchTransferDate.Text); clsDetails.BranchIDFrom = Convert.ToInt16(cboBranchFrom.SelectedItem.Value); clsDetails.BranchIDTo = Convert.ToInt16(cboBranchTo.SelectedItem.Value); clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.TransferrerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.TransferrerName = Session["Name"].ToString(); clsDetails.RequestedBy = txtRequestedBy.Text; clsDetails.Status = WBranchTransferStatus.Open; clsDetails.Remarks = txtRemarks.Text; WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.Update(clsDetails); clsWBranchTransfer.CommitAndDispose(); }
private void UpdateDeposit() { WBranchTransferDetails clsWBranchTransferDetails = new WBranchTransferDetails(); clsWBranchTransferDetails.WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); clsWBranchTransferDetails.Deposit = Convert.ToDecimal(txtWBranchTransferDeposit.Text); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.UpdateDeposit(clsWBranchTransferDetails.WBranchTransferID, clsWBranchTransferDetails.Deposit); clsWBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransferDetails = clsWBranchTransfer.Details(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransfer.CommitAndDispose(); UpdateFooter(clsWBranchTransferDetails); }
private void SetDataSource(ReportDocument Report) { long iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["WBranchTransferid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["WBranchTransferid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferid"].ToString(), Session.SessionID)); } } catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("WBranchTransferid") + 13), Session.SessionID)); } ReportDataset rptds = new ReportDataset(); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); System.Data.DataTable dt = clsWBranchTransfer.ListAsDataTable(iID); WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem(clsWBranchTransfer.Connection, clsWBranchTransfer.Transaction); System.Data.DataTable dtitems = clsWBranchTransferItem.ListAsDataTable(iID); clsWBranchTransfer.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.WBranchTransfer.NewRow(); foreach (DataColumn dc in rptds.WBranchTransfer.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.WBranchTransfer.Rows.Add(drNew); } foreach (System.Data.DataRow dr in dtitems.Rows) { DataRow drNew = rptds.WBranchTransferItems.NewRow(); foreach (DataColumn dc in rptds.WBranchTransferItems.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.WBranchTransferItems.Rows.Add(drNew); } Report.SetDataSource(rptds); SetParameters(Report); }
private void SubmitForApproval() { try { Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"]; Int64 WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.SubmitForApproval(WBranchTransferID, clsAccessUserDetails.Name); clsWBranchTransfer.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&WBranchTransferID=" + Common.Encrypt(WBranchTransferID.ToString(), Session.SessionID); Response.Redirect("Default.aspx" + stParam); } catch (Exception ex) { throw ex; } }
private void UpdateWBranchTransferDiscount() { WBranchTransferDetails clsWBranchTransferDetails = new WBranchTransferDetails(); clsWBranchTransferDetails.WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); clsWBranchTransferDetails.DiscountApplied = Convert.ToDecimal(txtWBranchTransferDiscountApplied.Text); clsWBranchTransferDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboWBranchTransferDiscountType.SelectedItem.Value); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.UpdateDiscount(clsWBranchTransferDetails.WBranchTransferID, clsWBranchTransferDetails.DiscountApplied, clsWBranchTransferDetails.DiscountType); clsWBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransferDetails = clsWBranchTransfer.Details(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransfer.CommitAndDispose(); UpdateFooter(clsWBranchTransferDetails); }
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) { Int64 WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); string ReceivedBy = txtReceivedBy.Text; WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.IssueGRN(WBranchTransferID, ReceivedBy, DeliveryDate); clsWBranchTransfer.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list",Session.SessionID) + "&WBranchTransferID=" + Common.Encrypt(WBranchTransferID.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 LoadRecord() { Int64 iID = 0; try { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID)); } catch { } try { if (iID == 0) iID = Convert.ToInt64(lblWBranchTransferID.Text);} catch { } WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); WBranchTransferDetails clsDetails = clsWBranchTransfer.Details(iID); clsWBranchTransfer.CommitAndDispose(); lblWBranchTransferID.Text = clsDetails.WBranchTransferID.ToString(); lnkWBranchTransferNo.Text = clsDetails.WBranchTransferNo; lnkWBranchTransferNo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&WBranchTransferID=" + Common.Encrypt(clsDetails.WBranchTransferID.ToString(), Session.SessionID); lblWBranchTransferDate.Text = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblBranchCodeFrom.Text = clsDetails.BranchCodeFrom; lblBranchCodeTo.Text = clsDetails.BranchCodeTo; lblWBranchTransferRemarks.Text = clsDetails.Remarks; txtWBranchTransferDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboWBranchTransferDiscountType.SelectedIndex = cboWBranchTransferDiscountType.Items.IndexOf(cboWBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblWBranchTransferDiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblWBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtWBranchTransferFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtWBranchTransferDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblWBranchTransferSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0"); lblWBranchTransferVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblWBranchTransferTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); lblStatus.Text = clsDetails.Status.ToString("G"); }
private void CancelWBranchTransfer() { long WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); string Remarks = txtRemarks.Text; WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.Cancel(WBranchTransferID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString())); clsWBranchTransfer.CommitAndDispose(); Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID)); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID)); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); WBranchTransferDetails clsDetails = clsWBranchTransfer.Details(iID); clsWBranchTransfer.CommitAndDispose(); lblWBranchTransferID.Text = clsDetails.WBranchTransferID.ToString(); lblWBranchTransferNo.Text = clsDetails.WBranchTransferNo; lblWBranchTransferDate.Text = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblBranchCodeFrom.Text = clsDetails.BranchCodeFrom; lblBranchCodeTo.Text = clsDetails.BranchCodeTo; lblWBranchTransferRemarks.Text = clsDetails.Remarks; txtWBranchTransferDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboWBranchTransferDiscountType.SelectedIndex = cboWBranchTransferDiscountType.Items.IndexOf(cboWBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblWBranchTransferDiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblWBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtWBranchTransferFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtWBranchTransferDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblWBranchTransferSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT + clsDetails.Freight - clsDetails.Deposit).ToString("#,##0.#0"); lblWBranchTransferVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblWBranchTransferTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); }
private Int64 SaveRecord() { WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.GetConnection(); lblWBranchTransferNo.Text = Constants.BRANCH_TRANSFER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsWBranchTransfer.LastTransactionNo(); WBranchTransferDetails clsDetails = new WBranchTransferDetails(); clsDetails.WBranchTransferNo = lblWBranchTransferNo.Text; clsDetails.WBranchTransferDate = Convert.ToDateTime(lblWBranchTransferDate.Text); clsDetails.BranchIDFrom = Convert.ToInt16(cboBranchFrom.SelectedItem.Value); clsDetails.BranchIDTo = Convert.ToInt16(cboBranchTo.SelectedItem.Value); clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.TransferrerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.TransferrerName = Session["Name"].ToString(); clsDetails.RequestedBy = txtRequestedBy.Text; clsDetails.Status = WBranchTransferStatus.Open; clsDetails.Remarks = txtRemarks.Text; Int64 id = clsWBranchTransfer.Insert(clsDetails); clsWBranchTransfer.CommitAndDispose(); return id; }