protected void GrdViewReceipt_RowDeleted(object sender, GridViewDeletedEventArgs e)
    {
        try
        {
            if (e.Exception == null)
            {
                GrdViewReceipt.DataBind();
            }
            else
            {
                if (e.Exception.InnerException != null)
                {
                    StringBuilder script = new StringBuilder();
                    script.Append("alert('You are not allowed to delete the record. Please contact Administrator.');");

                    if (e.Exception.InnerException.Message.IndexOf("Invalid Date") > -1)
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true);
                    }

                    e.ExceptionHandled = true;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#2
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         if (Page.IsValid)
         {
             GrdViewReceipt.DataBind();
         }
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
示例#3
0
    private void BindReceipt()
    {
        sDataSource = Request.Cookies["Company"].Value; // ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();

        string criteria     = string.Empty;
        string value        = string.Empty;
        bool   deletedItems = false;

        if (txtReceiptSearch.Text != "")
        {
            value = txtReceiptSearch.Text;
        }

        if (ddReceiptCriteria.SelectedValue != "0")
        {
            criteria = ddReceiptCriteria.SelectedValue;
        }

        deletedItems = ChkReceipt.Checked;

        BusinessLogic bl = new BusinessLogic();
        DataSet       ds = bl.lsReceipts(sDataSource, criteria, value, deletedItems);

        GrdViewReceipt.DataSource = ds;
        GrdViewReceipt.DataBind();

        if (ChkReceipt.Checked)
        {
            GrdViewReceipt.Columns[9].Visible = false;
            GrdViewReceipt.Columns[8].Visible = true;
        }
        else
        {
            GrdViewReceipt.Columns[8].Visible = false;
            GrdViewReceipt.Columns[9].Visible = true;
        }
    }
    protected void frmViewAdd_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        try
        {
            if (e.Exception == null)
            {
                if (hdSMS.Value == "YES")
                {
                    BusinessLogic bl   = new BusinessLogic();
                    string        conn = bl.CreateConnectionString(Request.Cookies["Company"].Value);

                    UtilitySMS utilSMS = new UtilitySMS(conn);
                    string     UserID  = Page.User.Identity.Name;

                    if (Session["Provider"] != null)
                    {
                        utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), hdMobile.Value, hdText.Value, true, UserID);
                    }
                    else
                    {
                        if (hdMobile.Value != "")
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('you are not configured to send SMS. Please contact Administrator.');", true);
                        }
                    }
                }

                MyAccordion.Visible = true;
                lnkBtnAdd.Visible   = true;
                frmViewAdd.Visible  = false;
                MyAccordion.Visible = true;
                GrdViewReceipt.DataBind();
                GrdViewReceipt.Visible = true;
            }
            else
            {
                if (e.Exception.InnerException != null)
                {
                    StringBuilder script = new StringBuilder();
                    script.Append("alert('You are not allowed to Update this record. Please contact Supervisor.');");

                    if (e.Exception.InnerException.Message.IndexOf("Invalid Date") > -1)
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured : " + e.Exception.InnerException.Message + "');", true);
                    }

                    e.ExceptionHandled = true;
                    e.KeepInEditMode   = true;
                    lnkBtnAdd.Visible  = false;
                    //frmViewAdd.Visible = true;
                    //GrdViewReceipt.Visible = true;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#5
0
    public void GetHeaderInfo()
    {
        // lblPurchaseOrder.Text = "";
        lblPaymentDue.Text = "";

        double        dFreight = 0;
        double        dFr      = 0;
        double        dUL      = 0;
        double        totalll  = 0;
        BusinessLogic bl       = new BusinessLogic(sDataSource);
        DataSet       dsBill   = new DataSet();

        DataSet    billSales = new DataSet();
        DataTable  dt;
        DataRow    drNew;
        DataColumn dc;

        string branchCode = Request.QueryString["BID"].ToString();
        int    billNo     = Convert.ToInt32(Request.QueryString["SID"].ToString());

        dsBill = bl.GetSalesForId(billNo, branchCode);
        //dsBill = bl.GetSalesForId(1);

        int    customerID = 0;
        string custAdd    = string.Empty;

        if ((dsBill != null) && (dsBill.Tables[0].Rows.Count > 0))
        {
            foreach (DataRow dr in dsBill.Tables[0].Rows)
            {
                //lblBillno.Text = Convert.ToString(dr["billno"]);
                //lblBillDate.Text = Convert.ToDateTime(dr["billdate"]).ToShortDateString();

                lblSupplierName.Text   = Convert.ToString(dr["Customername"]);
                lblSupplierNameEx.Text = Convert.ToString(dr["Customername"]);

                lblShipToName.Text   = Convert.ToString(dr["Customername"]);
                lblShipToNameEx.Text = Convert.ToString(dr["Customername"]);

                lblSupplierAddr1.Text = Convert.ToString(dr["CustomerAddress"]);
                lblSupplierAddr1.Text = Convert.ToString(dr["CustomerAddress"]);

                lblShipToAddr1.Text = Convert.ToString(dr["deliveryadd1"]);
                lblShipToAddr1.Text = Convert.ToString(dr["deliveryadd1"]);

                custAdd = Convert.ToString(dr["CustomerAddress"]);
                string[] address = new string[3] {
                    "", "", ""
                };
                address = custAdd.Split(new char[] { '\n' });

                string address2 = string.Empty;
                address2 = Convert.ToString(dr["CustomerAddress2"]);

                string address3 = string.Empty;
                address3 = Convert.ToString(dr["CustomerAddress3"]);

                string address4 = string.Empty;
                address4 = Convert.ToString(dr["deliveryadd2"]);

                string address5 = string.Empty;
                address5 = Convert.ToString(dr["deliveryadd3"]);

                if (address.Length >= 1)
                {
                    if (address[0] != string.Empty)
                    {
                        lblSupplierAddr1.Text = address[0];
                        // lblShipToAddr1.Text = address[0];
                    }
                }

                if (address2 != null)
                {
                    lblSupplierAddr2.Text = address2;
                    //lblShipToAddr2.Text = address2;
                }

                if (address4 != null)
                {
                    lblShipToAddr2.Text = address4;
                }

                if (address5 != null)
                {
                    lblShipToAddr3.Text = address5;
                }

                if (address3 != null)
                {
                    //lblSuppAdd3.Text = address3;
                }

                if (Convert.ToDouble(dr["CustomerIdMobile"]) == 0)
                {
                    lblSupplierPhn.Text   = "";
                    lblSupplierPhnEx.Text = "";

                    lblShipToPhn.Text   = "";
                    lblShipToPhnEx.Text = "";
                }
                else
                {
                    lblSupplierPhn.Text   = Convert.ToString(dr["CustomerIdMobile"]);
                    lblSupplierPhnEx.Text = Convert.ToString(dr["CustomerIdMobile"]);

                    lblShipToPhn.Text   = Convert.ToString(dr["CustomerIdMobile"]);
                    lblShipToPhnEx.Text = Convert.ToString(dr["CustomerIdMobile"]);
                }

                lblBillDate.Text   = Convert.ToString(dr["BillDate"]);
                lblBillDateEx.Text = Convert.ToString(dr["BillDate"]);

                lblInvoice.Text   = branchCode + "-" + Convert.ToString(dr["BillNo"]);
                lblInvoiceEx.Text = branchCode + "-" + Convert.ToString(dr["BillNo"]);

                lblCustomerID.Text   = Convert.ToString(dr["CustomerID"]);
                lblTransno.Text      = Convert.ToString(dr["Transno"]);
                lblCustomerIDEx.Text = Convert.ToString(dr["CustomerID"]);

                if (dr["paymode"].ToString() == "1")
                {
                    lblPayMode.Text        = "Cash";
                    divBankPaymode.Visible = false;

                    lblPayModeEx.Text        = "Cash";
                    divBankPaymodeEx.Visible = false;
                }
                else if (dr["paymode"].ToString() == "2")
                {
                    lblPayMode.Text           = "Bank / Credit Card";
                    divBankPaymode.Visible    = true;
                    divCreditCardNo.InnerHtml = dr["CreditCardNo"].ToString();
                    divBankName.InnerHtml     = dr["Debtor"].ToString();

                    lblPayModeEx.Text           = "Bank / Credit Card";
                    divBankPaymodeEx.Visible    = true;
                    divCreditCardNoEx.InnerHtml = dr["CreditCardNo"].ToString();
                    divBankNameEx.InnerHtml     = dr["Debtor"].ToString();
                }
                else if (dr["paymode"].ToString() == "3")
                {
                    lblPayMode.Text        = "Credit";
                    divBankPaymode.Visible = false;

                    lblPayModeEx.Text        = "Credit";
                    divBankPaymodeEx.Visible = false;
                }

                if (dr["MultiPayment"].ToString() == "YES")
                {
                    lblPayMode.Text           = "Multipayment";
                    divMultiPayment.Visible   = true;
                    GrdViewReceipt.DataSource = bl.ListReceiptsForBillNoOrder(dr["billno"].ToString(), dr["Branchcode"].ToString());
                    //GrdViewReceipt.DataSource = bl.ListReceiptsForBillNo(dr["billno"].ToString());
                    GrdViewReceipt.DataBind();

                    lblPayModeEx.Text           = "Multipayment";
                    divMultiPaymentEx.Visible   = true;
                    GrdViewReceiptEx.DataSource = bl.ListReceiptsForBillNoOrder(dr["billno"].ToString(), dr["Branchcode"].ToString());
                    //GrdViewReceipt.DataSource = bl.ListReceiptsForBillNo(dr["billno"].ToString());
                    GrdViewReceiptEx.DataBind();
                }
                else
                {
                    divMultiPayment.Visible   = false;
                    divMultiPaymentEx.Visible = false;
                }
            }

            if ((dsBill != null) && (dsBill.Tables[0].Rows.Count > 0))
            {
                dt = new DataTable();

                dc = new DataColumn("SalesPerson");
                dt.Columns.Add(dc);

                dc = new DataColumn("ShippingMethod");
                dt.Columns.Add(dc);

                dc = new DataColumn("ShippingTerms");
                dt.Columns.Add(dc);

                dc = new DataColumn("PaymentMode");
                dt.Columns.Add(dc);

                dc = new DataColumn("DueDate");
                dt.Columns.Add(dc);

                dc = new DataColumn("DeliveryDate");
                dt.Columns.Add(dc);

                billSales.Tables.Add(dt);

                DataTable table = dsBill.Tables[0];
                DataRow   row   = table.Rows[0];

                drNew = dt.NewRow();

                drNew["SalesPerson"] = GetEmployeeName(billNo, branchCode);

                drNew["ShippingMethod"] = string.Empty;
                drNew["ShippingTerms"]  = string.Empty;

                int    payMode     = Convert.ToInt32(row["Paymode"]);
                string paymentMode = string.Empty;
                if (payMode == 1)
                {
                    paymentMode = "Cash";
                }
                else if (payMode == 2)
                {
                    paymentMode = "Credit Card";
                }
                else if (payMode == 3)
                {
                    paymentMode = "Cheque";
                }
                else
                {
                    paymentMode = "Multi-Payment";
                }


                drNew["PaymentMode"] = paymentMode;

                drNew["DueDate"]      = string.Empty;
                drNew["DeliveryDate"] = string.Empty;

                billSales.Tables[0].Rows.Add(drNew);
            }

            gvGeneral.Visible    = false;
            gvGeneral.DataSource = billSales;
            gvGeneral.DataBind();

            gvGeneralEx.Visible    = false;
            gvGeneralEx.DataSource = billSales;
            gvGeneralEx.DataBind();
        }
    }
示例#6
0
    protected void rdoType_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (rdoType.SelectedValue == "Payment")
            {
                divPayment.Visible  = true;
                divReceipt.Visible  = false;
                divJournal.Visible  = false;
                divPurchase.Visible = false;
                divSales.Visible    = false;

                divPaymentResult.Visible = true;

                GrdViewJournal.DataSource = null;
                GrdViewJournal.DataBind();

                GrdViewPurchase.DataSource = null;
                GrdViewPurchase.DataBind();

                GrdViewReceipt.DataSource = null;
                GrdViewReceipt.DataBind();

                GrdViewSales.DataSource = null;
                GrdViewSales.DataBind();

                ChkSales.Checked    = false;
                ChkJournal.Checked  = false;
                ChkPurchase.Checked = false;
                ChkReceipt.Checked  = false;

                BindPayment();
            }
            else if (rdoType.SelectedValue == "Receipt")
            {
                divPayment.Visible  = false;
                divReceipt.Visible  = true;
                divJournal.Visible  = false;
                divPurchase.Visible = false;
                divSales.Visible    = false;

                ChkSales.Checked    = false;
                ChkJournal.Checked  = false;
                ChkPurchase.Checked = false;
                ChkPayDel.Checked   = false;

                divPaymentResult.Visible  = false;
                divJournalResult.Visible  = false;
                divPurchaseResult.Visible = false;
                divReceiptResult.Visible  = true;
                divSalesResult.Visible    = false;

                GrdViewPayment.DataSource = null;
                GrdViewPayment.DataBind();

                GrdViewJournal.DataSource = null;
                GrdViewJournal.DataBind();

                GrdViewPurchase.DataSource = null;
                GrdViewPurchase.DataBind();


                GrdViewSales.DataSource = null;
                GrdViewSales.DataBind();

                BindReceipt();
            }
            else if (rdoType.SelectedValue == "Journal")
            {
                divPayment.Visible  = false;
                divReceipt.Visible  = false;
                divJournal.Visible  = true;
                divPurchase.Visible = false;
                divSales.Visible    = false;

                ChkSales.Checked    = false;
                ChkPayDel.Checked   = false;
                ChkPurchase.Checked = false;
                ChkReceipt.Checked  = false;

                divPaymentResult.Visible  = false;
                divJournalResult.Visible  = true;
                divPurchaseResult.Visible = false;
                divReceiptResult.Visible  = false;
                divSalesResult.Visible    = false;

                GrdViewPayment.DataSource = null;
                GrdViewPayment.DataBind();

                GrdViewPurchase.DataSource = null;
                GrdViewPurchase.DataBind();

                GrdViewReceipt.DataSource = null;
                GrdViewReceipt.DataBind();

                GrdViewSales.DataSource = null;
                GrdViewSales.DataBind();

                BindJournal();
            }
            else if (rdoType.SelectedValue == "Purchase")
            {
                divPayment.Visible  = false;
                divReceipt.Visible  = false;
                divJournal.Visible  = false;
                divPurchase.Visible = true;
                divSales.Visible    = false;

                divPaymentResult.Visible  = false;
                divJournalResult.Visible  = false;
                divPurchaseResult.Visible = true;
                divReceiptResult.Visible  = false;
                divSalesResult.Visible    = false;

                ChkSales.Checked   = false;
                ChkJournal.Checked = false;
                ChkPayDel.Checked  = false;
                ChkReceipt.Checked = false;

                GrdViewPayment.DataSource = null;
                GrdViewPayment.DataBind();

                GrdViewJournal.DataSource = null;
                GrdViewJournal.DataBind();

                GrdViewReceipt.DataSource = null;
                GrdViewReceipt.DataBind();

                GrdViewSales.DataSource = null;
                GrdViewSales.DataBind();

                BindPurchase("0");
            }
            else
            {
                divReceipt.Visible  = false;
                divPayment.Visible  = false;
                divJournal.Visible  = false;
                divPurchase.Visible = false;
                divSales.Visible    = true;

                ChkPayDel.Checked   = false;
                ChkJournal.Checked  = false;
                ChkPurchase.Checked = false;
                ChkReceipt.Checked  = false;

                divPaymentResult.Visible  = false;
                divJournalResult.Visible  = false;
                divPurchaseResult.Visible = false;
                divReceiptResult.Visible  = false;
                divSalesResult.Visible    = true;

                GrdViewPayment.DataSource = null;
                GrdViewPayment.DataBind();

                GrdViewJournal.DataSource = null;
                GrdViewJournal.DataBind();

                GrdViewPurchase.DataSource = null;
                GrdViewPurchase.DataBind();

                GrdViewReceipt.DataSource = null;
                GrdViewReceipt.DataBind();


                BindSales(0);
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }