private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["transferinid"], Session.SessionID)); TransferIn clsTransferIn = new TransferIn(); TransferInDetails clsDetails = clsTransferIn.Details(iID); clsTransferIn.CommitAndDispose(); lblTransferInID.Text = clsDetails.TransferInID.ToString(); lblTransferInNo.Text = clsDetails.TransferInNo; lblTransferInDate.Text = clsDetails.TransferInDate.ToString("yyyy-MM-dd HH:mm:ss"); txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); cboSupplier.SelectedIndex = cboSupplier.Items.IndexOf(cboSupplier.Items.FindByValue(clsDetails.SupplierID.ToString())); txtSupplierContact.Text = clsDetails.SupplierContact; txtSupplierTelephoneNo.Text = clsDetails.SupplierTelephoneNo; lblTerms.Text = clsDetails.SupplierTerms.ToString("##0"); switch (clsDetails.SupplierModeOfTerms) { case 0: lblModeOfterms.Text = "Days"; break; case 1: lblModeOfterms.Text = "Months"; break; case 2: lblModeOfterms.Text = "Years"; break; } txtSupplierAddress.Text = clsDetails.SupplierAddress; cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString())); txtBranchAddress.Text = clsDetails.BranchAddress; txtRemarks.Text = clsDetails.Remarks; }
private void SetDataSource(ReportDocument Report) { long iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["transferinid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["transferinid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["transferinid"].ToString(), Session.SessionID)); } } catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("transferinid") + 13), Session.SessionID)); } ReportDataset rptds = new ReportDataset(); TransferIn clsTransferIn = new TransferIn(); MySqlDataReader myreader = clsTransferIn.List(iID, "TransferInID", SortOption.Ascending); while (myreader.Read()) { DataRow drNew = rptds.TransferIn.NewRow(); foreach (DataColumn dc in rptds.TransferIn.Columns) { drNew[dc] = "" + myreader[dc.ColumnName]; } rptds.TransferIn.Rows.Add(drNew); } myreader.Close(); TransferInItem clsTransferInItem = new TransferInItem(clsTransferIn.Connection, clsTransferIn.Transaction); MySqlDataReader myreaderitems = clsTransferInItem.List(iID, "TransferInItemID", SortOption.Ascending); while (myreaderitems.Read()) { DataRow drNew = rptds.TransferInItems.NewRow(); foreach (DataColumn dc in rptds.TransferInItems.Columns) { drNew[dc] = "" + myreaderitems[dc.ColumnName]; } rptds.TransferInItems.Rows.Add(drNew); } myreaderitems.Close(); clsTransferIn.CommitAndDispose(); Report.SetDataSource(rptds); SetParameters(Report); }
private void CancelTransferIn() { long TransferInID = Convert.ToInt64(lblTransferInID.Text); string Remarks = txtRemarks.Text; TransferIn clsTransferIn = new TransferIn(); clsTransferIn.Cancel(TransferInID, DateTime.Now, Remarks, Convert.ToInt64(Session["UID"].ToString())); clsTransferIn.CommitAndDispose(); Response.Redirect("Default.aspx?task=" + Common.Encrypt("list", Session.SessionID)); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["transferinid"], Session.SessionID)); TransferIn clsTransferIn = new TransferIn(); TransferInDetails clsDetails = clsTransferIn.Details(iID); clsTransferIn.CommitAndDispose(); lblTransferInID.Text = clsDetails.TransferInID.ToString(); lblTransferInNo.Text = clsDetails.TransferInNo; lblTransferInDate.Text = clsDetails.TransferInDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblSupplierID.Text = clsDetails.SupplierID.ToString(); lblSupplierCode.Text = clsDetails.SupplierCode.ToString(); string stParam = "?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.SupplierID.ToString(), Session.SessionID); lblSupplierCode.NavigateUrl = Constants.ROOT_DIRECTORY + "/PurchasesAndPayables/_Vendor/Default.aspx" + stParam; lblSupplierContact.Text = clsDetails.SupplierContact; lblSupplierTelephoneNo.Text = clsDetails.SupplierTelephoneNo; lblTerms.Text = clsDetails.SupplierTerms.ToString("##0"); switch (clsDetails.SupplierModeOfTerms) { case 0: lblModeOfterms.Text = "Days"; break; case 1: lblModeOfterms.Text = "Months"; break; case 2: lblModeOfterms.Text = "Years"; break; } lblSupplierAddress.Text = clsDetails.SupplierAddress; lblBranchID.Text = clsDetails.BranchID.ToString(); lblBranchCode.Text = clsDetails.BranchCode; lblBranchAddress.Text = clsDetails.BranchAddress; lblTransferInRemarks.Text = clsDetails.Remarks; txtTransferInDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboTransferInDiscountType.SelectedIndex = cboTransferInDiscountType.Items.IndexOf(cboTransferInDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblTransferInDiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblTransferInVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtTransferInFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtTransferInDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblTransferInSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT + clsDetails.Freight - clsDetails.Deposit).ToString("#,##0.#0"); lblTransferInVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblTransferInTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); }
private Int64 SaveRecord() { TransferIn clsTransferIn = new TransferIn(); clsTransferIn.GetConnection(); lblTransferInNo.Text = Constants.TRANSFER_IN_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsTransferIn.LastTransactionNo(); TransferInDetails clsDetails = new TransferInDetails(); clsDetails.TransferInNo = lblTransferInNo.Text; clsDetails.TransferInDate = Convert.ToDateTime(lblTransferInDate.Text); clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value); clsDetails.SupplierCode = cboSupplier.SelectedItem.Text; clsDetails.SupplierContact = txtSupplierContact.Text; clsDetails.SupplierAddress = txtSupplierAddress.Text; clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text; clsDetails.SupplierTerms = Convert.ToInt32(lblTerms.Text); switch (lblModeOfterms.Text) { case "Days": clsDetails.SupplierModeOfTerms = 0; break; case "Months": clsDetails.SupplierModeOfTerms = 1; break; case "Years": clsDetails.SupplierModeOfTerms = 2; break; } clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value); clsDetails.TransferrerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.TransferrerName = Session["Name"].ToString(); clsDetails.Status = TransferInStatus.Open; clsDetails.Remarks = txtRemarks.Text; Int64 id = clsTransferIn.Insert(clsDetails); clsTransferIn.CommitAndDispose(); return(id); }
private void SaveRecord() { TransferInDetails clsDetails = new TransferInDetails(); clsDetails.TransferInID = Convert.ToInt64(lblTransferInID.Text); clsDetails.TransferInNo = lblTransferInNo.Text; clsDetails.TransferInDate = Convert.ToDateTime(lblTransferInDate.Text); clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value); clsDetails.SupplierCode = cboSupplier.SelectedItem.Text; clsDetails.SupplierContact = txtSupplierContact.Text; clsDetails.SupplierAddress = txtSupplierAddress.Text; clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text; switch (lblModeOfterms.Text) { case "Days": clsDetails.SupplierModeOfTerms = 0; break; case "Months": clsDetails.SupplierModeOfTerms = 1; break; case "Years": clsDetails.SupplierModeOfTerms = 2; break; } clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value); clsDetails.TransferrerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.TransferrerName = Session["Name"].ToString(); clsDetails.Status = TransferInStatus.Open; clsDetails.Remarks = txtRemarks.Text; TransferIn clsTransferIn = new TransferIn(); clsTransferIn.Update(clsDetails); clsTransferIn.CommitAndDispose(); }
private void LoadList() { TransferIn clsTransferIn = new TransferIn(); DataClass clsDataClass = new DataClass(); Common Common = new Common(); string SortField = "TransferInID"; 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 dteOrderStartDate = DateTime.MinValue; try { if (txtOrderStartDate.Text != string.Empty) { dteOrderStartDate = Convert.ToDateTime(txtOrderStartDate.Text + " " + txtOrderStartTime.Text); } } catch { } DateTime dteOrderEndDate = DateTime.MinValue; try { if (txtOrderEndDate.Text != string.Empty) { dteOrderEndDate = Convert.ToDateTime(txtOrderEndDate.Text + " " + txtOrderEndTime.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 { } string SearchKey = txtSearch.Text; TransferInStatus status = (TransferInStatus)Enum.Parse(typeof(TransferInStatus), cboStatus.SelectedItem.Value); PageData.DataSource = clsTransferIn.SearchAsDataTable(status, dteOrderStartDate, dteOrderEndDate, dtePostingStartDate, dtePostingEndDate, SearchKey, SortField, sortoption).DefaultView; clsTransferIn.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; }