protected void GetPurchaseRecordsApprovalListByWarehouse(string warehouseId) { PurchaseRecordBLL purchaseRecord = new PurchaseRecordBLL(); try { DataTable dt = purchaseRecord.GetPurchaseRecordsApprovalListByWarehouse(warehouseId); purchaseRecordListGridView.DataSource = dt; purchaseRecordListGridView.DataBind(); if (purchaseRecordListGridView.Rows.Count > 0) { purchaseRecordListGridView.UseAccessibleHeader = true; purchaseRecordListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { purchaseRecord = null; } }
protected void GetPurchaseRecordById(string purchaseRecordId) { PurchaseRecordBLL purchaseRecord = new PurchaseRecordBLL(); try { DataTable dt = purchaseRecord.GetPurchaseRecordById(purchaseRecordId); if (dt.Rows.Count > 0) { prIDLabel.Text = dt.Rows[0]["PurchaseRequisitionId"].ToString(); prDateLabel.Text = " , " + dt.Rows[0]["PurchaseRequisitionDate"].ToString(); poIDLabel.Text = dt.Rows[0]["PurchaseOrderId"].ToString(); poDateLabel.Text = " , " + dt.Rows[0]["PurchaseOrderDate"].ToString(); warehouseIdLabel.Text = dt.Rows[0]["WarehouseId"].ToString(); warehouseNameLabel.Text = dt.Rows[0]["WarehouseName"].ToString(); vendorIdLabel.Text = dt.Rows[0]["VendorId"].ToString(); vendorNameLabel.Text = dt.Rows[0]["VendorName"].ToString(); requisitionNarrationLabel.Text = dt.Rows[0]["RequisitionNarration"].ToString(); vendorOrderDateLabel.Text = dt.Rows[0]["VendorOrderDate"].ToString(); vendorOrderNumberLabel.Text = dt.Rows[0]["VendorOrderNumber"].ToString(); vendorInvoiceNumberLabel.Text = dt.Rows[0]["VendorInvoiceNumber"].ToString(); receivedDateLabel.Text = dt.Rows[0]["ReceivedDate"].ToString(); lcNumberLabel.Text = dt.Rows[0]["LCNumber"].ToString(); transportTypeLabel.Text = dt.Rows[0]["TransportType"].ToString(); paymentModeLabel.Text = dt.Rows[0]["PaymentMode"].ToString(); narrationLabel.Text = dt.Rows[0]["Narration"].ToString(); bankLabel.Text = dt.Rows[0]["BankName"].ToString(); bankBranchLabel.Text = dt.Rows[0]["BankBranch"].ToString(); chequeNumberLabel.Text = dt.Rows[0]["ChequeNumber"].ToString(); chequeDateLabel.Text = dt.Rows[0]["ChequeDate"].ToString(); shippingAddressLabel.Text = dt.Rows[0]["ShippingAddress"].ToString(); billingAddressLabel.Text = dt.Rows[0]["BillingAddress"].ToString(); recordDateLabel.Text = dt.Rows[0]["RecordDate"].ToString(); statusLabel.Text = dt.Rows[0]["Status"].ToString(); totalAmountLabel.Text = dt.Rows[0]["TotalAmount"].ToString(); //vatLabel.Text = dt.Rows[0]["VAT"].ToString(); //totalPayableLabel.Text = dt.Rows[0]["TotalPayable"].ToString(); paidAmountLabel.Text = dt.Rows[0]["PaidAmount"].ToString(); transportCostLabel.Text = dt.Rows[0]["TransportCost"].ToString(); discountAmountLabel.Text = dt.Rows[0]["DiscountAmount"].ToString(); totalPayableLabel.Text = dt.Rows[0]["TotalPayable"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { purchaseRecord = null; } }
protected void requisitionListButton_Click(object sender, EventArgs e) { PurchaseRecordBLL purchaseRecord = new PurchaseRecordBLL(); try { if (warehouseDropDownList.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Warehouse Name field is required."; } else if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required."; } else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required."; } else { string warehouseId = warehouseDropDownList.SelectedValue.Trim(); string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()); string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()); string status = statusDropDownList.SelectedValue.Trim(); DataTable dt = purchaseRecord.GetPurchaseRecordsListByWarehouseDateRangeAndStatus(warehouseId, fromDate, toDate, status); purchaseRecordListGridView.DataSource = dt; purchaseRecordListGridView.DataBind(); if (purchaseRecordListGridView.Rows.Count > 0) { purchaseRecordListGridView.UseAccessibleHeader = true; purchaseRecordListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { purchaseRecord = null; } }
protected void GetPurchesRecordById(string PurchesRecordId) { PurchaseRecordBLL parRecordBll = new PurchaseRecordBLL(); try { DataTable dt = parRecordBll.GetPurchaseRecordById(PurchesRecordId); if (dt.Rows.Count > 0) { recordDateLabel.Text = dt.Rows[0]["RecordDate"].ToString(); statusLabel.Text = dt.Rows[0]["Status"].ToString(); //if (string.IsNullOrEmpty(dt.Rows[0]["WarehouseId"].ToString())) //{ // salesCenterIdLabel.Text = dt.Rows[0]["SalesCenterId"].ToString(); // salesCenterNameLabel.Text = dt.Rows[0]["SalesCenterName"].ToString(); //} salesCenterIdLabel.Text = dt.Rows[0]["WarehouseId"].ToString(); salesCenterNameLabel.Text = dt.Rows[0]["WarehouseName"].ToString(); salesCenterOrWareHouseIdLabel.Text = "Warehouse Id"; salesCenterOrWareHouseNameLabel.Text = "Warehouse Name"; // salesCenterIdLabel.Text = dt.Rows[0]["WarehouseId"].ToString(); //if (salesCenterIdLabel.Text[0] == 'W') //{ //} // salesCenterNameLabel.Text = dt.Rows[0]["WarehouseName"].ToString(); VendorIdLabel.Text = dt.Rows[0]["VendorId"].ToString(); vendorNameLabel.Text = dt.Rows[0]["VendorName"].ToString(); OderDatelabel.Text = dt.Rows[0]["VendorOrderDate"].ToString(); orderNumberLabel.Text = dt.Rows[0]["VendorOrderNumber"].ToString(); invoiceNumberLabel.Text = dt.Rows[0]["VendorInvoiceNumber"].ToString(); receiveDateLabel.Text = dt.Rows[0]["ReceivedDate"].ToString(); // [ReceivedDate] totalAmountLabel.Text = dt.Rows[0]["TotalAmount"].ToString(); discountAmountLabel.Text = dt.Rows[0]["DiscountAmount"].ToString(); transportCostLabel.Text = dt.Rows[0]["TransportCost"].ToString(); paidAmountLabel.Text = dt.Rows[0]["PaidAmount"].ToString(); //vatPercentageLabel.Text = dt.Rows[0]["VATPercentage"].ToString(); totalpayableLabel.Text = dt.Rows[0]["TotalPayable"].ToString(); NarationLabel.Text = dt.Rows[0]["Narration"].ToString(); salesDueAmountTextBox.Text = (decimal.Parse(totalpayableLabel.Text) - decimal.Parse(paidAmountLabel.Text)).ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { string message = "Some things goes wrong on create Sales Return"; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert( \"" + message + "\", \"\");"); } finally { parRecordBll = null; } }
protected void GetPurchesRecordProductListByIdForReturn(string salesRecordId) { PurchaseRecordBLL purchaseRecord = new PurchaseRecordBLL(); try { DataTable dt = purchaseRecord.GetPurchaseRecordProductListByIdForReturn(salesRecordId); if (dt.Rows.Count > 0) { dt.Columns.Add("ReturnQuantity"); dt.Columns.Add("ReturnAmount"); dt.AcceptChanges(); purchesRecordProductListGridView.DataSource = dt; purchesRecordProductListGridView.DataBind(); LumexSessionManager.Add("RPLdt", dt); for (int i = 0; i < purchesRecordProductListGridView.Rows.Count; i++) { if (purchesRecordProductListGridView.Rows[i].Cells[2].Text.Trim() == purchesRecordProductListGridView.Rows[i].Cells[6].Text.Trim()) { TextBox returnQuantityTextBox = (TextBox)purchesRecordProductListGridView.Rows[i].FindControl("returnQuantityTextBox"); returnQuantityTextBox.Enabled = false; } } if (purchesRecordProductListGridView.Rows.Count > 0) { purchesRecordProductListGridView.UseAccessibleHeader = true; purchesRecordProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { string message = "Some things goes wrong on create Sales Return"; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert( \"" + message + "\", \"\");"); } finally { purchaseRecord = null; } }
public string SavePurchaseRecord(PurchaseRecordBLL purchaseRecord, DataTable dtPrdList, LumexDBPlayer db) { string purchaseRecordId = ""; try { //db.AddParameters("@AccountId", purchaseRecord.AccountId.Trim()); db.AddParameters("@WarehouseId", purchaseRecord.WarehouseId.Trim()); db.AddParameters("@PurchaseRequisitionId", purchaseRecord.PurchaseRequisitionId.Trim()); db.AddParameters("@PurchaseOrderId", purchaseRecord.PurchaseOrderId.Trim()); db.AddParameters("@VendorId", purchaseRecord.VendorId.Trim()); db.AddParameters("@VendorOrderDate", purchaseRecord.VendorOrderDate.Trim()); db.AddParameters("@VendorOrderNumber", purchaseRecord.VendorOrderNumber.Trim()); db.AddParameters("@VendorInvoiceNumber", purchaseRecord.VendorInvoiceNumber.Trim()); db.AddParameters("@ReceivedDate", purchaseRecord.ReceivedDate.Trim()); db.AddParameters("@TotalAmount", purchaseRecord.TotalAmount.Trim()); //db.AddParameters("@VAT", purchaseRecord.VAT.Trim()); db.AddParameters("@DiscountAmount", purchaseRecord.DiscountAmount.Trim()); db.AddParameters("@TotalPayable", purchaseRecord.TotalPayable.Trim()); db.AddParameters("@PaidAmount", purchaseRecord.PaidAmount.Trim()); db.AddParameters("@TransportCost", purchaseRecord.TransportCost.Trim()); db.AddParameters("@Narration", purchaseRecord.Narration.Trim()); db.AddParameters("@LCNumber", purchaseRecord.LCNumber.Trim()); db.AddParameters("@TransportType", purchaseRecord.TransportType.Trim()); db.AddParameters("@ShippingAddress", purchaseRecord.ShippingAddress.Trim()); db.AddParameters("@BillingAddress", purchaseRecord.BillingAddress.Trim()); db.AddParameters("@PaymentMode", purchaseRecord.PaymentMode.Trim()); db.AddParameters("@Bank", purchaseRecord.Bank.Trim()); db.AddParameters("@BankBranch", purchaseRecord.BankBranch.Trim()); db.AddParameters("@ChequeNumber", purchaseRecord.ChequeNumber.Trim()); db.AddParameters("@ChequeDate", purchaseRecord.ChequeDate.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); DataTable dt = db.ExecuteDataTable("INSERT_PURCHASE_RECORD", true); if (dt.Rows.Count > 0) { purchaseRecordId = dt.Rows[0][0].ToString(); } for (int i = 0; i < dtPrdList.Rows.Count; i++) { db.ClearParameters(); db.AddParameters("@WarehouseId", purchaseRecord.WarehouseId.Trim()); db.AddParameters("@PurchaseRecordId", purchaseRecordId.Trim()); db.AddParameters("@ProductId", dtPrdList.Rows[i]["ProductId"].ToString()); db.AddParameters("@Quantity", dtPrdList.Rows[i]["Quantity"].ToString()); db.AddParameters("@Amount", dtPrdList.Rows[i]["Amount"].ToString()); db.AddParameters("@RatePerUnit", dtPrdList.Rows[i]["RatePerUnit"].ToString()); db.AddParameters("@UnitPrice", dtPrdList.Rows[i]["UnitPrice"].ToString()); db.AddParameters("@Status", dtPrdList.Rows[i]["Status"].ToString()); db.AddParameters("@Narration", dtPrdList.Rows[i]["Narration"].ToString()); db.ExecuteNonQuery("INSERT_PURCHASE_RECORD_PRODUCT", true); } db.ClearParameters(); db.AddParameters("@PurchaseOrderId", purchaseRecord.PurchaseOrderId.Trim()); db.AddParameters("@Status", purchaseRecord.Status.Trim()); db.ExecuteNonQuery("UPDATE_PURCHASE_ORDER_STATUS_BY_ID", true); return purchaseRecordId; } catch (Exception) { throw; } finally { purchaseRecord = null; dtPrdList = null; } }
protected void approveButton_Click(object sender, EventArgs e) { PurchaseRecordBLL purchaseRecord = new PurchaseRecordBLL(); try { purchaseRecord.ApprovePurchaseRecord(warehouseIdLabel.Text.Trim(), idLabel.Text.Trim()); MyAlertBox("alert(\"Purchase Record Approved Successfully.\"); window.location=\"/UI/PurchaseRecord/PurchaseApprovalList.aspx\""); } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { purchaseRecord = null; } }
//protected void LoadVendors() //{ // VendorBLL vendor = new VendorBLL(); // try // { // DataTable dt = vendor.GetActiveVendors(); // vendorDropDownList.DataSource = dt; // vendorDropDownList.DataValueField = "VendorId"; // vendorDropDownList.DataTextField = "VendorName"; // vendorDropDownList.DataBind(); // vendorDropDownList.Items.Insert(0, ""); // vendorDropDownList.SelectedIndex = 0; // } // catch (Exception ex) // { // msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; // } // finally // { // vendor = null; // } //} protected void GetPaymentInfo() { ReceivePaymentBLL receivePayment = new ReceivePaymentBLL(); PurchaseRecordBLL purchaseRecord = new PurchaseRecordBLL(); try { DataTable dtInfo = purchaseRecord.GetPurchaseRecordById(purchaseRecordIdTextBox.Text.Trim()); if (dtInfo.Rows.Count > 0) { //salesCenterIdLabel.Text = dtInfo.Rows[0]["SalesCenterId"].ToString(); //salesCenterNameLabel.Text = dtInfo.Rows[0]["SalesCenterName"].ToString(); recordIdLabel.Text = dtInfo.Rows[0]["PurchaseRecordId"].ToString(); recordDateLabel.Text = dtInfo.Rows[0]["RecordDate"].ToString(); vendorIdLabel.Text = dtInfo.Rows[0]["VendorId"].ToString(); vendorNameLabel.Text = dtInfo.Rows[0]["VendorName"].ToString(); warehouseIdLabel.Text = dtInfo.Rows[0]["WarehouseId"].ToString(); warehouseNameLabel.Text = dtInfo.Rows[0]["WarehouseName"].ToString(); //salesCenterIdLabel.Text = dtInfo.Rows[0]["WarehouseId"].ToString(); //salesCenterNameLabel.Text = dtInfo.Rows[0]["WarehouseName"].ToString(); totalAmountLabel.Text = dtInfo.Rows[0]["TotalAmount"].ToString(); //vatLabel.Text = dtInfo.Rows[0]["VAT"].ToString(); transportCostLabel.Text = dtInfo.Rows[0]["TransportCost"].ToString(); totalPayableLabel.Text = dtInfo.Rows[0]["TotalPayable"].ToString(); } DataTable dt = receivePayment.GetVendorPayments(vendorIdLabel.Text.Trim(), purchaseRecordIdTextBox.Text.Trim(), "PA"); paymentDetailsGridView.DataSource = dt; paymentDetailsGridView.DataBind(); decimal amt = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Status"].ToString() == "Approved") { amt = amt + decimal.Parse(dt.Rows[i]["Amount"].ToString()); } } totalReceivedLabel.Text = amt.ToString(); currentPayableLabel.Text = (decimal.Parse(totalPayableLabel.Text) - decimal.Parse(totalReceivedLabel.Text)).ToString(); if (paymentDetailsGridView.Rows.Count > 0) { paymentDetailsGridView.UseAccessibleHeader = true; paymentDetailsGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { receivePayment = null; purchaseRecord = null; } }