Example #1
0
    private void SoDetails(Int64 id)
    {
        DataTable ds = new DataTable();

        ds = ClsSalesRegister.Get_SalesOrderforApproval(id);
        GvwSaleseOrderDetails.DataSource = ds;
        GvwSaleseOrderDetails.DataBind();
    }
    private void SoDetails(Int64 id)
    {
        DataTable ds = new DataTable();

        ds = ClsSalesRegister.Get_SalesOrderforInvocie(id);
        GvwPurchaseInvocie.DataSource = ds;
        GvwPurchaseInvocie.DataBind();
    }
Example #3
0
    private void GetSalesManager()
    {
        DataTable ds = new DataTable();

        try
        {
            ds = ClsSalesRegister.Get_SalesOrderForSaleRegister(Convert.ToDateTime(Txt_FromDate.Text.Trim()), Convert.ToDateTime(Txt_ToDate.Text.Trim()));
            GvwSalesRegister.DataSource = ds;
            GvwSalesRegister.DataBind();
            ViewState["Data"] = ds;
            ds.Dispose();
            if (ViewState["PageINdex"] != null)
            {
                GvwSalesRegister.PageIndex = Convert.ToInt32(ViewState["PageINdex"].ToString());
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void BtnInvoiceSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Txt_InvoiceDate.Text != "" && Txt_InvoiceNo.Text != "")
            {
                //Check point
                //--t_purchase order detail and t_purchareinvoicedetail
                //string pono = TxtPoNo.Text;
                foreach (GridViewRow row in GvwPurchaseInvocie.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        string    HidProduct0   = ((HiddenField)row.Cells[3].FindControl("HidProduct0")).Value;
                        DataTable DT            = ClsCheck.Get_SalesCheck(TxtPoNo.Text.Trim(), Convert.ToInt32(HidProduct0));
                        int       POQUANTITY    = Convert.ToInt32(DT.Rows[0]["SO_QUANTITY"].ToString());
                        int       PURCHASEIN    = Convert.ToInt32(DT.Rows[0]["SALES_INVOICE"].ToString());
                        int       TxtInQuantity = Convert.ToInt32(((TextBox)row.Cells[3].FindControl("TxtInQuantity")).Text);
                        if (POQUANTITY < PURCHASEIN + TxtInQuantity)
                        {
                            this.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script type=text/javascript>alert('Check Invoice Quantity')</script>");
                            return;
                        }
                    }
                }


                string   asd      = hidDetails_ID.Value;
                DateTime PODATE   = Convert.ToDateTime(TxtPoDate.Text);
                string   ponumber = TxtPoNo.Text;

                int      invoiceid;
                DateTime invoicedate = DateTime.Now;
                string   invoiceno = ""; string totalAmount = "";
                invoicedate = Convert.ToDateTime(Txt_InvoiceDate.Text.Trim());
                invoiceno   = Txt_InvoiceNo.Text.Trim();

                totalAmount = Txt_SubTotal.Text.Trim();
                //taxid = Convert.ToInt32(DrpTaxType.SelectedItem.Value);
                result2 = ClsSalesRegister.InsertSalesInvoice(out invoiceid, Convert.ToInt32(asd), ponumber, PODATE,
                                                              invoiceno, invoicedate, Convert.ToDouble(totalAmount), Convert.ToInt32(Session["Id"]));
                if (result2)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('invoice Saved Successfully...');</script>", false);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('invoice Insertion Failed...');</script>", false);
                }


                foreach (GridViewRow row in GvwPurchaseInvocie.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        string LblSlno       = ((Label)row.Cells[0].FindControl("LblSlno")).Text;
                        string lblCatagory   = ((Label)row.Cells[1].FindControl("lblCatagory")).Text;
                        Int32  HidCatagory0  = Convert.ToInt32(((HiddenField)row.Cells[2].FindControl("HidCatagory0")).Value);
                        string LblProduct    = ((Label)row.Cells[3].FindControl("LblProduct")).Text;
                        Int32  HidProduct0   = Convert.ToInt32(((HiddenField)row.Cells[4].FindControl("HidProduct0")).Value);
                        Int32  LblQuantity   = Convert.ToInt32(((Label)row.Cells[3].FindControl("LblQuantity")).Text);
                        double LblPrice      = Convert.ToDouble(((Label)row.Cells[3].FindControl("LblPrice")).Text);
                        double POTaxPrice    = Convert.ToDouble(((Label)row.Cells[3].FindControl("Lbltaxid")).Text);
                        double pototalamount = Convert.ToDouble(((Label)row.Cells[3].FindControl("LbltotalAmount")).Text);

                        string TxtInQuantity      = ((TextBox)row.Cells[3].FindControl("TxtInQuantity")).Text;
                        string TxtInPrice         = ((TextBox)row.Cells[4].FindControl("TxtInPrice")).Text;
                        double invoicetotalamount = Convert.ToDouble(((Label)row.Cells[3].FindControl("LblInvocietotalPrice")).Text);
                        string InvoiceTaxPrice    = ((TextBox)row.Cells[3].FindControl("txttaxid")).Text;

                        string loaction = TxtSoLocation.Text.Trim();

                        result1 = ClsSalesRegister.InsertSalesInvoicedetails(invoiceid, Convert.ToInt32(asd), HidCatagory0, HidProduct0,
                                                                             LblQuantity, LblPrice, POTaxPrice, pototalamount,
                                                                             Convert.ToInt32(TxtInQuantity), Convert.ToDouble(TxtInPrice), InvoiceTaxPrice, invoicetotalamount, Convert.ToInt32(Session["Id"].ToString()), loaction, LblProduct, invoicedate);
                    }
                }



                Txt_InvoiceNo.Text   = "";
                Txt_InvoiceDate.Text = "";
                Txt_SubTotal.Text    = "0.00";

                TxtInTotalAmount.Text = "0.00";
                GetSalesManager();
                Panel1.Visible = false; Panel2.Visible = true;
            }
        }
        catch (Exception ex)
        {
        }
    }