protected void generateButton_OnClick(object sender, EventArgs e)
        {
            try
            {

                IPOSReportBLL iposReport = new IPOSReportBLL();
                iposReport.GetProductSalesRecordListByProductId(drpdwnProduct.SelectedValue, fromDateTextBox.Text,toDateTextBox.Text);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);

                //}
                //else if (drpdwnReportOnStock.SelectedValue == "2")
                //{
                //    IPOSReportBLL iposReport = new IPOSReportBLL();
                //    iposReport.GetAvailableProductBySaclesCenterIdPRWise(SalesCenterIdDropDownList.SelectedValue);
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);

                //}
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                MyAlertBox("MyOverlayStop();");
            }
        }
예제 #2
0
        protected void generateButton_Click(object sender, EventArgs e)
        {
            try
            {

                IPOSReportBLL iposReport = new IPOSReportBLL();
                iposReport.Get_Income_Statement_by_Date(reportTypeDropDownList.SelectedValue, SCWHDropDownList.SelectedValue, toDateTextBox.Text, fromDateTextBox.Text);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);


            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                MyAlertBox("MyOverlayStop();");
            }
        }
        protected void generateButton_Click(object sender, EventArgs e)
        {
            try
            {

                IPOSReportBLL iposReport = new IPOSReportBLL();
                iposReport.GetSalesCenterCustomerDueAmountList(salesCenterDropDownList.SelectedValue);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);


            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                MyAlertBox("MyOverlayStop();");
            }
        }
        protected void exportButton_Click(object sender, EventArgs e)
        {
            try
            {

                IPOSReportBLL iposReport = new IPOSReportBLL();
                iposReport.GetPurchaseRecordbySC_Date_RANGE_STATUS(drpdwnSalesCenterOrWarehouse.SelectedValue, toDateTextBox.Text, fromDateTextBox.Text, drpdwnPRStatus.SelectedValue);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ExportReportForm();", true);

                //else if (drpdwnReportOnStock.SelectedValue == "2")
                //{
                //    IPOSReportBLL iposReport = new IPOSReportBLL();
                //    iposReport.GetAvailableProductBySaclesCenterId(SalesCenterIdDropDownList.SelectedValue);
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ExportReportForm();", true);

                //}
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                MyAlertBox("MyOverlayStop();");
            }
        }
        protected void printInvoiceButton_OnClick(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                string JournalNo = customerPaymentListGridView.Rows[row.RowIndex].Cells[0].Text.ToString();
                string customerId = customerDropDownList.SelectedValue;
                string WHSCId = LumexSessionManager.Get("UserWareHouseId").ToString();

                IPOSReportBLL iposReport = new IPOSReportBLL();
                iposReport.GetReceivePaymentVaucharbyVendororCustomer(JournalNo, customerId, WHSCId);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);


            }
            catch (Exception ex)
            {

                //
            }
        }
        protected void printInvoiceButton_OnClick(object sender, EventArgs e)
        {
            LinkButton lnkBtn = (LinkButton)sender;
            GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;
            string cmdarg = "1";
            string voucherId = voucherListGridView.Rows[row.RowIndex].Cells[0].Text.ToString();
            //string salesCencerId = salesCenterDropDownList.SelectedValue;

            IPOSReportBLL iposReport = new IPOSReportBLL();
            iposReport.GetCreditOrDebitVoucherByVoucherId(voucherId, drpdwnSalesCenterOrWarehouse.SelectedValue, cmdarg);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);

        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            DebitCreditVoucherBLL debitCreditVoucher = new DebitCreditVoucherBLL();
            Button btn = (Button)sender;
            string cmdarg = btn.CommandArgument;

            try
            {
                if (accountHeadDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Account Head field is required.";
                }
                else if (amountTextBox.Text.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Amount field is required.";
                }
                else if (cashAccountHeadDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Cash Account Head field is required.";
                }
                else if (voucherNumberTextBox.Text.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Voucher Number field is required.";
                }
                else if (payToFromCompanyDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Pay To/From Company field is required.";
                }
                else if (narrationTextBox.Text.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Narration field is required.";
                }
                else
                {
                    debitCreditVoucher.ManualVoucherNumber = voucherNumberTextBox.Text.Trim();
                    debitCreditVoucher.AccountId = accountHeadDropDownList.SelectedValue.Trim();
                    debitCreditVoucher.CounterAccountId = cashAccountHeadDropDownList.SelectedValue.Trim();
                    debitCreditVoucher.Amount = amountTextBox.Text.Trim();
                    debitCreditVoucher.PayToFromCompany = payToFromCompanyDropDownList.SelectedValue.Trim();
                    debitCreditVoucher.Narration = narrationTextBox.Text.Trim();
                    debitCreditVoucher.SalesCenterId = drpdwnSalesCenterOrWarehouse.SelectedValue;

                    DataTable dt = debitCreditVoucher.SaveDebitVoucherCash();

                    if (dt.Rows.Count > 0)
                    {
                        if (cmdarg == "2")
                        {
                            IPOSReportBLL iposReport = new IPOSReportBLL();
                            iposReport.GetCreditOrDebitVoucherByVoucherId(dt.Rows[0][0].ToString(), debitCreditVoucher.SalesCenterId.ToString(),cmdarg);
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);
                        }
                        

                        string message = "Debit Voucher Cash <span class='actionTopic'>Created</span> Successfully with Voucher Number: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>.";
                        MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/AccUI/DebitVoucher/DebitVoucherCashList.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                    }
                    else
                    {
                        string message = "<span class='actionTopic'>Failed</span> to Create Debit Voucher Cash.";
                        MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");");
                    }

                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                debitCreditVoucher = null;
            }
        }
예제 #8
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            SalesOrderBLL salesOrder = new SalesOrderBLL();
            DataTable dtPrdList = new DataTable();
            DataRow dr = null;
            decimal quantity = 0;
            double rate = 0;
            double amount = 0;
            TextBox orderQuantityTextBox;
            TextBox ratePerUnitTextBox;
            TextBox amountTextBox;
            TextBox heighTextBox;
            TextBox widthTextBox;
            TextBox UnitTextBox;
            TextBox totalUnitTextBox;
            Label vatLabel;
            int i = 0;

            dtPrdList.Columns.Add(new DataColumn("ProductId"));
            dtPrdList.Columns.Add(new DataColumn("Height"));
            dtPrdList.Columns.Add(new DataColumn("Width"));
            dtPrdList.Columns.Add(new DataColumn("OrderUnit"));
            dtPrdList.Columns.Add(new DataColumn("TotalUnit"));
            dtPrdList.Columns.Add(new DataColumn("OrderQuantity"));
            dtPrdList.Columns.Add(new DataColumn("Quantity"));
            dtPrdList.Columns.Add(new DataColumn("RatePerUnit"));
            dtPrdList.Columns.Add(new DataColumn("VATPercentage"));
            dtPrdList.Columns.Add(new DataColumn("Amount"));


            try
            {
                for (i = 0; i < selectedProductListGridView.Rows.Count; i++)
                {
                    //double availAbleQuantity = Convert.ToDouble(selectedProductListGridView.Rows[i].Cells[3].Text.ToString());
                    heighTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("heightTextBox");
                    widthTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("WidthTextBox");
                    UnitTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("UnitTextBox");
                    totalUnitTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("totalUnitTextBox");
                    orderQuantityTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("orderQuantityTextBox");
                    ratePerUnitTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("ratePerUnitTextBox");
                    amountTextBox = (TextBox)selectedProductListGridView.Rows[i].FindControl("amountTextBox");
                    vatLabel = (Label)selectedProductListGridView.Rows[i].FindControl("lblVatparcentage");
                    if (string.IsNullOrEmpty(orderQuantityTextBox.Text.Trim()) || !decimal.TryParse(orderQuantityTextBox.Text.Trim(), out quantity))
                    {
                        msg = "Product ID [" + selectedProductListGridView.Rows[i].Cells[0].Text.ToString() + "] has no valid quantity.";
                        msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = msg;
                        return;
                    }
                    else if (string.IsNullOrEmpty(ratePerUnitTextBox.Text.Trim()) || !double.TryParse(ratePerUnitTextBox.Text.Trim(), out rate))
                    {
                        msg = "Product ID [" + selectedProductListGridView.Rows[i].Cells[0].Text.ToString() + "] has no valid rate.";
                        msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = msg;
                        return;
                    }
                    else if (string.IsNullOrEmpty(amountTextBox.Text.Trim()) || !double.TryParse(amountTextBox.Text.Trim(), out amount))
                    {
                        msg = "Product ID [" + selectedProductListGridView.Rows[i].Cells[0].Text.ToString() + "] has no valid amount.";
                        msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = msg;
                        return;
                    }
                    //else if (Convert.ToDouble(orderQuantityTextBox.Text) > availAbleQuantity)
                    //{
                    //    msg = "Product ID [" + selectedProductListGridView.Rows[i].Cells[0].Text.ToString() + "] has no valid Availability.";
                    //    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = msg;
                    //    return;
                    //}
                    else
                    {
                        dr = dtPrdList.NewRow();

                        dr["ProductId"] = selectedProductListGridView.Rows[i].Cells[0].Text.ToString();
                        // dr["Available"] = selectedProductListGridView.Rows[i].Cells[3].Text.ToString();
                        dr["Height"] = heighTextBox.Text;
                        dr["Width"] = widthTextBox.Text;
                        dr["OrderUnit"] = UnitTextBox.Text;
                        dr["TotalUnit"] = totalUnitTextBox.Text;
                        dr["Quantity"] = quantity.ToString();
                        dr["RatePerUnit"] = rate.ToString();
                        dr["VATPercentage"] = vatLabel.Text; //selectedProductListGridView.Rows[i].Cells[8].Text.ToString();
                        dr["Amount"] = amount.ToString();

                        dtPrdList.Rows.Add(dr);
                    }
                }

                if (accountHeadDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Select Any Account Head";
                    return;
                }

                else if (totalAmountTextBox.Text.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Total Amount field is required.";
                    return;
                }
                else if (receivedAmountTextBox.Text.Trim() == "" && customerIdDropDownList.SelectedIndex == 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Received Amount field is required.";
                    return;
                }
                else if (changeAmountTextBox.Text.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Change Amount field is required.";
                    return;
                }
                else if (customerIdDropDownList.SelectedItem.Text.Trim() == "Retail" && Convert.ToDecimal(receivableAmountTextBox.Text) > Convert.ToDecimal(receivedAmountTextBox.Text) && customerNameTextBox.Text == "" && customerContactNumberTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Warning!!!"; msgDetailLabel.Text = "Can not sale Retail on Due please select Customer.";
                    return;
                }
                else if ((paymentModeDropDownList.SelectedValue == "Cheque" && chequeNumberTextBox.Text == "") || (paymentModeDropDownList.SelectedValue == "Cheque" && chequeDateTextBox.Text == ""))
                {
                    //if (chequeNumberTextBox.Text == "" || chequeDateTextBox.Text == "")
                    //{
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Cheque Number Or Cheque Date field is Required.";
                    return;
                    // }

                }
                //if (string.IsNullOrEmpty(DuesAmoutPayTextBox.Text))
                //{
                //    DuesAmoutPayTextBox.Text = "0";
                //}
                else
                {

                    if (receivedAmountTextBox.Text == "")
                    {
                        receivedAmountTextBox.Text = "0";
                    }
                    salesOrder.SalesCenterId = ddlSelectWareHouseOrSalesCenter.SelectedValue.Trim();
                    salesOrder.CustomerId = customerIdDropDownList.SelectedValue.Trim();
                    salesOrder.CustomerName = customerNameTextBox.Text.Trim();
                    salesOrder.CustomerContactNumber = customerContactNumberTextBox.Text.Trim();
                    salesOrder.CustomerAddress = customerAddressTextBox.Text.Trim();
                    salesOrder.TotalAmount = totalAmountTextBox.Text.Trim();
                    salesOrder.DiscountAmount = discountTextBox.Text.Trim();
                    salesOrder.VAT = vatTextBox.Text.Trim();
                    salesOrder.TotalReceivable = receivableAmountTextBox.Text.Trim();
                    salesOrder.Due = "0";//DuesAmoutPayTextBox.Text;
                    salesOrder.SalesOrderId = "";
                    salesOrder.ReceivedAmount = receivedAmountTextBox.Text.Trim();
                    salesOrder.ChangeAmount = (Convert.ToDecimal(salesOrder.ReceivedAmount) - Convert.ToDecimal(salesOrder.TotalReceivable)).ToString();
                    salesOrder.TotalVATAmount = totalVATAmountHiddenField.Value;

                    salesOrder.AccountId = accountHeadDropDownList.SelectedValue;
                    salesOrder.CustomerId = customerIdDropDownList.SelectedValue.Trim();
                    salesOrder.PaymentMode = paymentModeDropDownList.SelectedValue;
                    // receivePayment.Amount = receivedAmountTextBox.Text.Trim();
                    salesOrder.Bank = bankDropDownList.Text;
                    salesOrder.BankBranch = bankBranchTextBox.Text;
                    salesOrder.ChequeNumber = chequeNumberTextBox.Text;
                    salesOrder.ChequeDate = LumexLibraryManager.ParseAppDate(chequeDateTextBox.Text);
                    salesOrder.OthersDes = txtbxDescription.Text;
                    salesOrder.OthersAmount = txtbxOthersAmount.Text;
                    salesOrder.Narration = txtbxNarration.Text;

                    if (dtPrdList.Rows.Count == selectedProductListGridView.Rows.Count)
                    {
                        string salesRecordId = salesOrder.SaveRetailSales(dtPrdList);
                        if (salesRecordId != "")
                        {
                            IPOSReportBLL iposReport = new IPOSReportBLL();
                            iposReport.GetSalesInvoiceBySalesRecord(salesRecordId, salesOrder.SalesCenterId);
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);


                            string message = "Product's <span class='actionTopic'>Sales</span> Successfully with Sale ID: <span class='actionTopic'>" +
                            salesRecordId + "</span>.";
                            MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Sales/RetailSales.aspx\"; }; SuccessAlert(\"" +
                                "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                        }

                        else
                        {
                            string message = "Product's <span class='actionTopic'>Sales</span> Falied" +
                            salesRecordId + "</span>.";
                            MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Sales/RetailSales.aspx\"; }; SuccessAlert(\"" +
                                "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                salesOrder = null;
                dtPrdList = null;
            }
        }
        protected void exportButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (titleSalesCenterOrWarehouse.Text == "Sales Center")
                {
                    if (drpdwnReportOnStock.SelectedValue == "1")
                    {
                        IPOSReportBLL iposReport = new IPOSReportBLL();
                        iposReport.GetAvailableProductBySaclesCenterId(drpdwnSalesCenterOrWarehouse.SelectedValue);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ExportReportForm();", true);

                    }
                    else if (drpdwnReportOnStock.SelectedValue == "2")
                    {
                        IPOSReportBLL iposReport = new IPOSReportBLL();
                        iposReport.GetAvailableProductBySaclesCenterIdPRWise(drpdwnSalesCenterOrWarehouse.SelectedValue);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ExportReportForm();", true);

                    }
                }
                else
                {
                    if (drpdwnReportOnStock.SelectedValue == "1")
                    {
                        IPOSReportBLL iposReport = new IPOSReportBLL();
                        iposReport.GetAvailableProductByWarehouseId(drpdwnSalesCenterOrWarehouse.SelectedValue);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ExportReportForm();", true);

                    }
                    else if (drpdwnReportOnStock.SelectedValue == "2")
                    {
                        IPOSReportBLL iposReport = new IPOSReportBLL();
                        iposReport.GetAvailableProductByWarehouseIdPRWise(drpdwnSalesCenterOrWarehouse.SelectedValue);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ExportReportForm();", true);

                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                MyAlertBox("MyOverlayStop();");
            }
        }
예제 #10
0
        protected void printInvoiceButton_OnClick(object sender, EventArgs e)
        {
            LinkButton lnkBtn = (LinkButton)sender;
            GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

            string salesRecordId = salesRecordListGridView.Rows[row.RowIndex].Cells[0].Text.ToString();
            string salesCencerId = salesCenterDropDownList.SelectedValue;

            IPOSReportBLL iposReport = new IPOSReportBLL();
            iposReport.GetSalesInvoiceBySalesRecord(salesRecordId, salesCencerId);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "ViewReportForm();", true);

        }