public List <PosDetails> RePrintBill(string BillNumber) { List <PosDetails> posDetails = new List <PosDetails>(); PosDetails bill; SqlConnection con = new SqlConnection(Connection); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand("stp_srv_RePrintBill", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@BillNumber", SqlDbType.NVarChar).Value = BillNumber; da.SelectCommand = cmd; da.Fill(ds); con.Close(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { bill = new PosDetails(); bill.ActiveState = true; bill.BillNumber = ds.Tables[0].Rows[i]["BillNumber"].ToString(); bill.totalQty = Convert.ToInt32(ds.Tables[0].Rows[i]["TotalQty"]); bill.GrossBillValue = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["GrossBillValue"]); bill.Discount = Convert.ToInt32(ds.Tables[0].Rows[i]["BillDiscount"]); bill.GST = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["TotalGSTValue"]); bill.NetBillValue = Convert.ToInt32(ds.Tables[0].Rows[i]["NetBillValue"]); bill.DiscountAmount = Convert.ToInt16(ds.Tables[0].Rows[i]["DiscountAmount"]); bill.CGSTValue = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["CGSTValue"]); bill.SGSTValue = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["SGSTValue"]); bill.IGSTValue = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["IGSTValue"]); bill.ItemGSTValue = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["ItemGSTValue"]); bill.BillingName = ds.Tables[0].Rows[i]["ProductBillingName"].ToString(); bill.Cost = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["TotalValue"]); bill.Rate = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["Rate"]); bill.BarcodeNumber = ds.Tables[0].Rows[i]["Barcode"].ToString(); bill.GSTpercent = Convert.ToInt32(ds.Tables[0].Rows[i]["GSTPercent"]); bill.HSNCode = Convert.ToInt32(ds.Tables[0].Rows[i]["HSN"]); bill.BillDate = Convert.ToString(ds.Tables[0].Rows[i]["BillDate"]); bill.BillPendingAmount = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["BillRemainderValue"]); posDetails.Add(bill); } } else { bill = new PosDetails(); bill.ActiveState = false; posDetails.Add(bill); } return(posDetails); }
public List <PosDetails> GetPendingBill() { List <PosDetails> posDetails = new List <PosDetails>(); PosDetails bill; SqlConnection con = new SqlConnection(Connection); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand("stp_srv_SelectPendingBill", con); cmd.CommandType = CommandType.StoredProcedure; da.SelectCommand = cmd; da.Fill(ds); con.Close(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { bill = new PosDetails(); bill.ActiveState = true; bill.BillNumber = ds.Tables[0].Rows[i]["BillNumber"].ToString(); bill.totalQty = Convert.ToInt32(ds.Tables[0].Rows[i]["TotalQty"]); bill.GrossBillValue = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["GrossBillValue"]); bill.Discount = Convert.ToInt32(ds.Tables[0].Rows[i]["BillDiscount"]); bill.GST = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["TotalGSTValue"]); bill.NetBillValue = Convert.ToInt32(ds.Tables[0].Rows[i]["NetBillValue"]); bill.BillDate = Convert.ToString(ds.Tables[0].Rows[i]["BillDate"]); bill.BillPendingAmount = (float)Convert.ToDouble(ds.Tables[0].Rows[i]["BillRemainderValue"]); posDetails.Add(bill); } } else { bill = new PosDetails(); bill.ActiveState = false; posDetails.Add(bill); } return(posDetails); }
public List <PosDetails> PosInitialization(string BarcodeNumber, string SingleBarcode) { List <PosDetails> bill = new List <PosDetails>(); PosDetails posDetails; DataTable dt = new DataTable(); SqlConnection con = new SqlConnection(Connection); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("stp_srv_GetPosBarcodeStatusCheck", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@BarcodeNumber", SqlDbType.NVarChar).Value = Convert.ToString(BarcodeNumber); cmd.Parameters.Add("@SingleBarcode", SqlDbType.Bit).Value = Convert.ToBoolean(SingleBarcode); da.SelectCommand = cmd; da.Fill(dt); con.Close(); if (dt.Rows.Count > 0) { posDetails = new PosDetails(); posDetails.ActiveState = true; posDetails.BarcodeNumber = dt.Rows[0]["Barcode"].ToString(); posDetails.BarcodeStatus = dt.Rows[0]["BarcodeStatus"].ToString(); posDetails.GST = Convert.ToInt32(dt.Rows[0]["GST"].ToString()); posDetails.HSNCode = Convert.ToInt32(dt.Rows[0]["HSN"].ToString()); posDetails.ProductName = dt.Rows[0]["ProductName"].ToString(); posDetails.BillingName = dt.Rows[0]["BillingName"].ToString(); bill.Add(posDetails); } else { posDetails = new PosDetails(); posDetails.ActiveState = false; bill.Add(posDetails); } return(bill); }
public List <PosDetails> BillDetails(int TotalQty, double GrossBillValue, double BillDiscount, double TotalGSTValue, double NetBillValue, DataTable dtBillDetails, double DiscountAmount, int TransactionType, double CashAmount, double CardAmount, int CardNumber, string UserID, bool PendingBill, double PendingAmount) { float TotalPaidAmount = (float)CashAmount + (float)CardAmount; List <PosDetails> posDetails = new List <PosDetails>(); PosDetails bill; SqlConnection con = new SqlConnection(Connection); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand("stp_srv_PosGenerateBillDetails", con); cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = 1234; cmd.Parameters.Add("@TotalQty", SqlDbType.Int).Value = TotalQty; cmd.Parameters.Add("@GrossBillValue", SqlDbType.Float).Value = GrossBillValue; cmd.Parameters.Add("@BillDiscount", SqlDbType.Float).Value = BillDiscount; cmd.Parameters.Add("@TotalGSTValue", SqlDbType.Float).Value = TotalGSTValue; cmd.Parameters.Add("@NetBillValue", SqlDbType.Float).Value = NetBillValue; cmd.Parameters.Add("@DiscountAmount", SqlDbType.Float).Value = DiscountAmount; cmd.Parameters.Add("@TransactionType", SqlDbType.Int).Value = TransactionType; cmd.Parameters.Add("@CashAmount", SqlDbType.Float).Value = CashAmount; cmd.Parameters.Add("@CardAmount", SqlDbType.Float).Value = CardAmount; cmd.Parameters.Add("@CardNumber", SqlDbType.Int).Value = CardNumber; cmd.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = UserID; cmd.Parameters.Add("@PendingBill", SqlDbType.Bit).Value = PendingBill; cmd.Parameters.Add("@PendingAmount", SqlDbType.Float).Value = PendingAmount; cmd.Parameters.Add("@TotalPaidAmount", SqlDbType.Float).Value = TotalPaidAmount; SqlParameter param = cmd.Parameters.AddWithValue("@BillList", dtBillDetails); param.SqlDbType = SqlDbType.Structured; // cmd.ExecuteNonQuery(); da.SelectCommand = cmd; da.Fill(ds); con.Close(); // PosDetails bill; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { bill = new PosDetails(); bill.ActiveState = true; bill.BillNumber = ds.Tables[1].Rows[i]["BillNumber"].ToString(); bill.totalQty = Convert.ToInt32(ds.Tables[1].Rows[i]["TotalQty"]); bill.GrossBillValue = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["GrossBillValue"]); bill.Discount = Convert.ToInt32(ds.Tables[1].Rows[i]["BillDiscount"]); bill.GST = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["TotalGSTValue"]); bill.NetBillValue = Convert.ToInt32(ds.Tables[1].Rows[i]["NetBillValue"]); bill.DiscountAmount = Convert.ToInt16(ds.Tables[1].Rows[i]["DiscountAmount"]); bill.CGSTValue = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["CGSTValue"]); bill.SGSTValue = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["SGSTValue"]); bill.IGSTValue = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["IGS" + "TValue"]); bill.ItemGSTValue = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["ItemGSTValue"]); bill.BillingName = ds.Tables[1].Rows[i]["ProductBillingName"].ToString(); bill.Cost = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["TotalValue"]); bill.Rate = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["Rate"]); bill.BarcodeNumber = ds.Tables[1].Rows[i]["Barcode"].ToString(); bill.GSTpercent = Convert.ToInt32(ds.Tables[1].Rows[i]["GSTPercent"]); bill.HSNCode = Convert.ToInt32(ds.Tables[1].Rows[i]["HSN"]); bill.BillDate = Convert.ToString(ds.Tables[1].Rows[i]["BillDate"]); bill.BillPendingAmount = (float)Convert.ToDouble(ds.Tables[1].Rows[i]["BillRemainderValue"]); posDetails.Add(bill); } } else { bill = new PosDetails(); bill.ActiveState = false; posDetails.Add(bill); } return(posDetails); }