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;
            }
        }
示例#2
0
        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 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;
            }
        }