Beispiel #1
0
    public static int Insert_Selling(Userr_Property_Tbl_Selling u)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "insert_tbl_selling_sp";

        cmd.Parameters.Add(Create_Parameter.Convert_Int("@c_id", u.c_id));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@bill_no", u.bill_no));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@total_amount", u.total_amount));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@current_pay", u.current_pay));
        cmd.Parameters.Add(Create_Parameter.Convert_Int("@remaining_amount", u.remaining_amount));
        cmd.Parameters.Add(Create_Parameter.Convert_String("@purchase_date", u.purchase_date));

        return(Create_Command.Execute_Non_Query(cmd));
    }
Beispiel #2
0
    //bill generation
    protected void btn_generate_bill_Click(object sender, EventArgs e)
    {
        if (Session["remaining_amount_customer"] != "")
        {
            if (Convert.ToInt32(txt_total_amount.Text) >= Convert.ToInt32(txt_current_pay.Text))
            {
                string bill_no1         = Session["remaining_amount_customer"].ToString();
                string remaining_amount = Convert.ToString(Convert.ToInt32(txt_total_amount.Text) - Convert.ToInt32(txt_current_pay.Text));
                Update_Logic.update_remaining_amount(bill_no1, remaining_amount);
                Response.Redirect("Bill.aspx");
            }
            else
            {
                lbl_msg.Text = "Current Pay should not be Greater than Total Amount";
                mpe.Show();
            }
        }
        else if (Session["Bill_no_customer_page"] != "")
        {
            if (Convert.ToInt32(txt_total_amount.Text) >= Convert.ToInt32(txt_current_pay.Text))
            {
                String bill_no1         = Session["Bill_no_customer_page"].ToString();
                string remaining_amount = Convert.ToString(Convert.ToInt32(txt_total_amount.Text) - Convert.ToInt32(txt_current_pay.Text));
                Update_Logic.update_remaining_amount(bill_no1, remaining_amount);
                Response.Redirect("Bill.aspx");
            }
            else
            {
                lbl_msg.Text = "Current Pay should not be Greater than Total Amount";
                mpe.Show();
            }
        }
        else
        {
            Userr_Property_Tbl_Selling u = new Userr_Property_Tbl_Selling();
            u.bill_no       = Session["bill_no"].ToString();
            u.c_id          = find_customer_id();
            u.total_amount  = txt_total_amount.Text;
            u.purchase_date = txt_purchase_date.Text;
            u.current_pay   = txt_current_pay.Text;

            if ((Convert.ToInt32(u.total_amount)) < (Convert.ToInt32(u.current_pay)))
            {
                amount_error.ForeColor = System.Drawing.Color.Red;
                amount_error.Text      = "current pay should not be greater than total amount";
                return;
            }

            u.remaining_amount = Convert.ToString(Convert.ToInt32(u.total_amount) - Convert.ToInt32(u.current_pay));
            int i = Insert_Logic.Insert_Selling(u);

            if (i == 1)
            {
                Response.Redirect("Bill.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('Sry Try Again')", true);
            }
            Session["bill_no"] = "";
            Session["id"]      = "";
        }
    }