private void SetDataSource(ReportDocument Report) { Int64 iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["branchtransferid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["branchtransferid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["branchtransferid"].ToString(), Session.SessionID)); } } catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("branchtransferid") + 13), Session.SessionID)); } ReportDataset rptds = new ReportDataset(); BranchTransfer clsBranchTransfer = new BranchTransfer(); System.Data.DataTable dt = clsBranchTransfer.ListAsDataTable(iID); BranchTransferItem clsBranchTransferItem = new BranchTransferItem(clsBranchTransfer.Connection, clsBranchTransfer.Transaction); System.Data.DataTable dtitems = clsBranchTransferItem.ListAsDataTable(iID); clsBranchTransfer.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.BranchTransfer.NewRow(); foreach (DataColumn dc in rptds.BranchTransfer.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.BranchTransfer.Rows.Add(drNew); } foreach (System.Data.DataRow dr in dtitems.Rows) { DataRow drNew = rptds.BranchTransferItems.NewRow(); foreach (DataColumn dc in rptds.BranchTransferItems.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.BranchTransferItems.Rows.Add(drNew); } Report.SetDataSource(rptds); SetParameters(Report); }
private Int64 SaveRecord() { BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.GetConnection(); lblBranchTransferNo.Text = Constants.BRANCH_TRANSFER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsBranchTransfer.LastTransactionNo(); BranchTransferDetails clsDetails = new BranchTransferDetails(); clsDetails.BranchTransferNo = lblBranchTransferNo.Text; clsDetails.BranchTransferDate = Convert.ToDateTime(lblBranchTransferDate.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 = BranchTransferStatus.Open; clsDetails.Remarks = txtRemarks.Text; Int64 id = clsBranchTransfer.Insert(clsDetails); clsBranchTransfer.CommitAndDispose(); return id; }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["BranchTransferID"],Session.SessionID)); BranchTransfer clsBranchTransfer = new BranchTransfer(); BranchTransferDetails clsDetails = clsBranchTransfer.Details(iID); clsBranchTransfer.CommitAndDispose(); lblBranchTransferID.Text = clsDetails.BranchTransferID.ToString(); lblBranchTransferNo.Text = clsDetails.BranchTransferNo; lblBranchTransferDate.Text = clsDetails.BranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblBranchCodeFrom.Text = clsDetails.BranchCodeFrom; lblBranchCodeTo.Text = clsDetails.BranchCodeTo; lblBranchTransferRemarks.Text = clsDetails.Remarks; txtBranchTransferDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboBranchTransferDiscountType.SelectedIndex = cboBranchTransferDiscountType.Items.IndexOf(cboBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblBranchTransferDiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtBranchTransferFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtBranchTransferDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblBranchTransferSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT + clsDetails.Freight - clsDetails.Deposit).ToString("#,##0.#0"); lblBranchTransferVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblBranchTransferTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); }
private void CancelBranchTransfer() { long BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text); string Remarks = txtRemarks.Text; BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.Cancel(BranchTransferID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString())); clsBranchTransfer.CommitAndDispose(); Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID)); }
private void LoadList() { BranchTransfer clsBranchTransfer = new BranchTransfer(); DataClass clsDataClass = new DataClass(); Common Common = new Common(); string SortField = "BranchTransferID"; 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 { } BranchTransferDetails searchKey = new BranchTransferDetails(); searchKey.BranchTransferNo = txtSearch.Text; BranchTransferStatus status = (BranchTransferStatus)Enum.Parse(typeof(BranchTransferStatus), cboStatus.SelectedItem.Value); PageData.DataSource = clsBranchTransfer.ListAsDataTable(0, 0, searchKey, status, dteTransferStartDate, dteTransferEndDate, dtePostingStartDate, dtePostingEndDate, null, null, SortField, sortoption).DefaultView; clsBranchTransfer.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 LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["BranchTransferID"], Session.SessionID)); BranchTransfer clsBranchTransfer = new BranchTransfer(); BranchTransferDetails clsDetails = clsBranchTransfer.Details(iID); clsBranchTransfer.CommitAndDispose(); lblBranchTransferID.Text = clsDetails.BranchTransferID.ToString(); lblBranchTransferNo.Text = clsDetails.BranchTransferNo; lblBranchTransferDate.Text = clsDetails.BranchTransferDate.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 SaveRecord() { BranchTransferDetails clsDetails = new BranchTransferDetails(); clsDetails.BranchTransferID = long.Parse(lblBranchTransferID.Text); clsDetails.BranchTransferNo = lblBranchTransferNo.Text; clsDetails.BranchTransferDate = Convert.ToDateTime(lblBranchTransferDate.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 = BranchTransferStatus.Open; clsDetails.Remarks = txtRemarks.Text; BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.Update(clsDetails); clsBranchTransfer.CommitAndDispose(); }
private void UpdateDeposit() { BranchTransferDetails clsBranchTransferDetails = new BranchTransferDetails(); clsBranchTransferDetails.BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text); clsBranchTransferDetails.Deposit = Convert.ToDecimal(txtBranchTransferDeposit.Text); BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.UpdateDeposit(clsBranchTransferDetails.BranchTransferID, clsBranchTransferDetails.Deposit); clsBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblBranchTransferID.Text)); clsBranchTransferDetails = clsBranchTransfer.Details(Convert.ToInt64(lblBranchTransferID.Text)); clsBranchTransfer.CommitAndDispose(); UpdateFooter(clsBranchTransferDetails); }
private void UpdateBranchTransferDiscount() { BranchTransferDetails clsBranchTransferDetails = new BranchTransferDetails(); clsBranchTransferDetails.BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text); clsBranchTransferDetails.DiscountApplied = Convert.ToDecimal(txtBranchTransferDiscountApplied.Text); clsBranchTransferDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboBranchTransferDiscountType.SelectedItem.Value); BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.UpdateDiscount(clsBranchTransferDetails.BranchTransferID, clsBranchTransferDetails.DiscountApplied, clsBranchTransferDetails.DiscountType); clsBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblBranchTransferID.Text)); clsBranchTransferDetails = clsBranchTransfer.Details(Convert.ToInt64(lblBranchTransferID.Text)); clsBranchTransfer.CommitAndDispose(); UpdateFooter(clsBranchTransferDetails); }
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 BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text); string ReceivedBy = txtReceivedBy.Text; BranchTransfer clsBranchTransfer = new BranchTransfer(); clsBranchTransfer.IssueGRN(BranchTransferID, ReceivedBy, DeliveryDate); clsBranchTransfer.CommitAndDispose(); string stParam = "?task=" + Common.Encrypt("list",Session.SessionID) + "&BranchTransferID=" + Common.Encrypt(BranchTransferID.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); } }