Esempio n. 1
0
        public static List <VoucherVM> LoadDEGrid(string leadId, string dealerCode)
        {
            List <VoucherVM> lst = new List <VoucherVM>();

            ReceiptNo = leadId;

            ds = new DataSet();

            ds.Tables.Add();

            ds.Tables[0].Columns.Add(new DataColumn("AccountCode", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("AccountTitle", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Debit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Credit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Narration", typeof(string)));

            SqlParameter[] dsParamInv =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                new SqlParameter("@ExpInvNo",   SqlDbType.Char, 8)
            };

            dsParamInv[0].Value = dealerCode;
            dsParamInv[1].Value = leadId;

            totCredit = totDebit = 0;

            DataSet dsReceipt = new DataSet();


            dsReceipt = sysfun.FillDataSet("SP_DailyExpense_Voucher", dsParamInv);

            if (dsReceipt.Tables[0].Rows.Count > 0)
            {
                //double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Compute("SUM(InsAmount)", ""));
                double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Rows[0]["InsAmount"]);
                string Naration      = "Daily Expenditure No : " + dsReceipt.Tables[0].Rows[0]["ExpInvNo"].ToString().Trim() + " | " +
                                       "Remarks : " + dsReceipt.Tables[0].Rows[0]["Remarks"].ToString().Trim();

                AddDebitAmount(ReceiptAmount, "", Naration, dealerCode);

                for (int i = 0; i < dsReceipt.Tables[0].Rows.Count; i++)
                {
                    SqlParameter[] param =
                    {
                        new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                        new SqlParameter("@ExpInvNo",   SqlDbType.Char, 8),
                        new SqlParameter("@ExpFor",     SqlDbType.Char, 8)
                    };

                    param[0].Value = dealerCode;
                    param[1].Value = leadId;
                    param[2].Value = dsReceipt.Tables[0].Rows[i]["ExpFor"].ToString();


                    DataSet dsServiceCharges = sysfun.FillDataSet("SP_GetExpenseHeadDetail", param);


                    string AccountCode = dsServiceCharges.Tables[0].Rows[0]["AccountCode"].ToString();
                    string VehExpDesc  = dsServiceCharges.Tables[0].Rows[0]["EDesc"].ToString().Trim();
                    double Amount      = Convert.ToDouble(dsServiceCharges.Tables[0].Rows[0]["Amount"]);


                    AddCreditAmount(Amount, AccountCode, Naration, VehExpDesc);
                }
                return(lst = EnumerableExtension.ToList <VoucherVM>(ds.Tables[0]));
            }

            return(lst);
        }
Esempio n. 2
0
        public static List <VoucherVM> LoadGVGrid(string leadId, string dealerCode, string ChassisNo)
        {
            List <VoucherVM> lst = new List <VoucherVM>();


            ReceiptNo = leadId;
            //ReceiptNo = Session["leadId"];

            ds = new DataSet();

            ds.Tables.Add();

            ds.Tables[0].Columns.Add(new DataColumn("AccountCode", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("AccountTitle", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Debit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Credit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Narration", typeof(string)));

            SqlParameter[] dsParamInv =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                new SqlParameter("@RecNo",      SqlDbType.Char, 8),
                new SqlParameter("@ChasisNo",   SqlDbType.Char, 25)
            };

            dsParamInv[0].Value = dealerCode;
            dsParamInv[1].Value = leadId;
            dsParamInv[2].Value = ChassisNo;

            totCredit = totDebit = 0;

            DataSet dsReceipt = new DataSet();


            dsReceipt = sysfun.FillDataSet("SP_Get_VehicleAccountCodeDetail", dsParamInv);

            if (dsReceipt.Tables[0].Rows.Count > 0)
            {
                //  string Customer = dsReceipt.Tables[0].Rows[0]["CusDesc"].ToString().Trim();
                //DataRow[] dr = dsReceipt.Tables[0].Compute("SUM(ReceiptAmount)","");
                double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Compute("SUM(Amount)", ""));
                //double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Rows[0]["ReceiptAmount"]);
                string Naration = "Type  : " + dsReceipt.Tables[0].Rows[0]["Type"].ToString().Trim()
                                  + " | " + "Chassis No : " + dsReceipt.Tables[0].Rows[0]["ChasisNo"].ToString().Trim()
                                  + " | " + "Product : " + dsReceipt.Tables[0].Rows[0]["ProdDesc"].ToString().Trim();
                string Acc = dsReceipt.Tables[0].Rows[0]["VehicleStock"].ToString().Trim();
                AddDebitAmount(ReceiptAmount, Acc, Naration, dealerCode);

                for (int i = 0; i < dsReceipt.Tables[0].Rows.Count; i++)
                {
                    SqlParameter[] param =
                    {
                        new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                        new SqlParameter("@RecNo",      SqlDbType.Char, 8),
                        new SqlParameter("@ChasisNo",   SqlDbType.Char, 25)
                        //new SqlParameter("@VehExpCode",SqlDbType.Char,8)
                    };

                    param[0].Value = dealerCode;
                    param[1].Value = leadId;
                    param[2].Value = ChassisNo;


                    DataSet dsServiceCharges = sysfun.FillDataSet("SP_Get_VehicleAccountCodeDetail", param);


                    string AccountCode = dsServiceCharges.Tables[0].Rows[0]["VendorPayable"].ToString();
                    string VehExpDesc  = dsServiceCharges.Tables[0].Rows[0]["VendorDesc"].ToString().Trim();
                    double Amount      = Convert.ToDouble(dsServiceCharges.Tables[0].Rows[0]["Amount"]);


                    AddCreditAmount(Amount, AccountCode, Naration, VehExpDesc);
                }
                return(lst = EnumerableExtension.ToList <VoucherVM>(ds.Tables[0]));
            }

            return(lst);
        }
Esempio n. 3
0
        public static List <VoucherVM> LoadCSGrid(string leadId, string dealerCode, string ChassisNo, string VouchNo)
        {
            List <VoucherVM> lst = new List <VoucherVM>();

            ReceiptNo = VouchNo;

            ds = new DataSet();

            ds.Tables.Add();

            ds.Tables[0].Columns.Add(new DataColumn("AccountCode", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("AccountTitle", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Debit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Credit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Narration", typeof(string)));

            SqlParameter[] dsParamInv =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                new SqlParameter("@RceiptNo",   SqlDbType.Char, 8)
            };

            dsParamInv[0].Value = dealerCode;
            dsParamInv[1].Value = leadId;

            totCredit = totDebit = 0;

            DataSet dsReceipt = new DataSet();


            dsReceipt = sysfun.FillDataSet("SP_Select_ReceiptDetail", dsParamInv);

            if (dsReceipt.Tables[0].Rows.Count > 0)
            {
                string Customer  = dsReceipt.Tables[0].Rows[0]["CusDesc"].ToString().Trim();
                string ChasisNo  = dsReceipt.Tables[0].Rows[0]["ChasisNo"].ToString().Trim();
                string EngineNo  = dsReceipt.Tables[0].Rows[0]["EngineNo"].ToString().Trim();
                string InvoiceNo = dsReceipt.Tables[0].Rows[0]["InvoiceNo"].ToString().Trim();
                //DataRow[] dr = dsReceipt.Tables[0].Compute("SUM(ReceiptAmount)","");
                double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Compute("SUM(ReceiptAmount)", ""));
                //double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Rows[0]["ReceiptAmount"]);
                string Naration = "Sale Invoice : " + dsReceipt.Tables[0].Rows[0]["ReceiptNo"].ToString().Trim() + " | " +
                                  "Customer : " + dsReceipt.Tables[0].Rows[0]["CusDesc"].ToString().Trim() + " | " +
                                  "ChassisNo : " + ChasisNo;
                string Account = dsReceipt.Tables[0].Rows[0]["AccountCode"].ToString().ToString();
                AddCustomerDebitAmount(ReceiptAmount, Account, Customer, Naration);

                for (int i = 0; i < dsReceipt.Tables[0].Rows.Count; i++)
                {
                    SqlParameter[] param =
                    {
                        new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                        new SqlParameter("@ReceiptNo",  SqlDbType.Char, 8),
                        new SqlParameter("@VehExpCode", SqlDbType.Char, 8)
                    };

                    param[0].Value = dealerCode;
                    param[1].Value = leadId;
                    param[2].Value = dsReceipt.Tables[0].Rows[i]["VehExpCode"].ToString();


                    DataSet dsServiceCharges = sysfun.FillDataSet("SP_GetServiceAmountTemp", param);


                    string AccountCode = dsServiceCharges.Tables[0].Rows[0]["ServicesAccountCode"].ToString();
                    string VehExpDesc  = dsServiceCharges.Tables[0].Rows[0]["VehExpDesc"].ToString().Trim();
                    double Amount      = Convert.ToDouble(dsServiceCharges.Tables[0].Rows[0]["ReceiptAmount"]);


                    AddCreditAmount(Amount, AccountCode, Naration, VehExpDesc);
                }
                return(lst = EnumerableExtension.ToList <VoucherVM>(ds.Tables[0]));
            }

            return(lst);
        }
Esempio n. 4
0
        public static List <VoucherVM> LoadCSI(string leadId, string dealerCode, string ChassisNo)
        {
            List <VoucherVM> lst = new List <VoucherVM>();


            ReceiptNo = leadId;
            //ReceiptNo = Session["leadId"];

            ds = new DataSet();

            ds.Tables.Add();

            ds.Tables[0].Columns.Add(new DataColumn("AccountCode", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("AccountTitle", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Debit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Credit", typeof(string)));
            ds.Tables[0].Columns.Add(new DataColumn("Narration", typeof(string)));

            SqlParameter[] dsParamInv =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),
                new SqlParameter("@TransCode",  SqlDbType.Char, 8),
                new SqlParameter("@ChasisNo",   SqlDbType.Char, 25)
            };

            dsParamInv[0].Value = dealerCode;
            dsParamInv[1].Value = leadId;
            dsParamInv[2].Value = ChassisNo;
            ReceiptNo           = leadId;
            totCredit           = totDebit = 0;

            DataSet dsReceipt = new DataSet();


            dsReceipt = sysfun.FillDataSet("SP_Get_VehicleSaleAccountCode", dsParamInv);

            if (dsReceipt.Tables[0].Rows.Count > 0)
            {
                //  string Customer = dsReceipt.Tables[0].Rows[0]["CusDesc"].ToString().Trim();
                //DataRow[] dr = dsReceipt.Tables[0].Compute("SUM(ReceiptAmount)","");
                double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Compute("SUM(TotalAmount)", ""));
                //double ReceiptAmount = Convert.ToDouble(dsReceipt.Tables[0].Rows[0]["ReceiptAmount"]);
                string Naration = "Type  : " + dsReceipt.Tables[0].Rows[0]["StockType"].ToString().Trim()
                                  + " | " + "Chassis No : " + dsReceipt.Tables[0].Rows[0]["ChassisNo"].ToString().Trim()
                                  + " | " + "Product : " + dsReceipt.Tables[0].Rows[0]["ProdDesc"].ToString().Trim();
                string Acc         = dsReceipt.Tables[0].Rows[0]["CusAccountCode"].ToString().Trim();
                string CusDesc     = dsReceipt.Tables[0].Rows[0]["CusDesc"].ToString().Trim();
                string MarketRate  = dsReceipt.Tables[0].Rows[0]["MarketRate"].ToString().Trim();
                string Discount    = dsReceipt.Tables[0].Rows[0]["Discount"].ToString().Trim();
                string Own         = dsReceipt.Tables[0].Rows[0]["OwnMoney"].ToString().Trim();
                string DownMoney   = dsReceipt.Tables[0].Rows[0]["DownMoney"].ToString().Trim();
                string AccountCode = dsReceipt.Tables[0].Rows[0]["VendorPayable"].ToString();
                string VendorDesc  = dsReceipt.Tables[0].Rows[0]["VendorDesc"].ToString().Trim();
                double SalePrice   = Convert.ToDouble(dsReceipt.Tables[0].Rows[0]["FactoryPrice"]);
                double market      = Convert.ToDouble(MarketRate);
                double discount    = Convert.ToDouble(Discount);
                if (market > 0)
                {
                    AddCustomerDebitAmount(ReceiptAmount, Acc, CusDesc, Naration);
                    // AddCustomerDebitAmount(discount, DownMoney, "Down Money", Naration);
                    AddCreditAmount(SalePrice, AccountCode, Naration, VendorDesc);
                    AddCreditAmount(market, Own, Naration, "Own Money");
                }
                if (discount > 0)
                {
                    AddCustomerDebitAmount(ReceiptAmount, Acc, CusDesc, Naration);
                    AddCustomerDebitAmount(discount, DownMoney, "Down Money", Naration);
                    AddCreditAmount(SalePrice, AccountCode, Naration, VendorDesc);
                    // AddCreditAmount(market, Own, Naration, "Own Money");
                }
                if (discount == 0 && market == 0)
                {
                    AddCustomerDebitAmount(ReceiptAmount, Acc, CusDesc, Naration);
                    //AddCustomerDebitAmount(discount, DownMoney, "Down Money", Naration);
                    AddCreditAmount(SalePrice, AccountCode, Naration, VendorDesc);
                    // AddCreditAmount(market, Own, Naration, "Own Money");
                }


                return(lst = EnumerableExtension.ToList <VoucherVM>(ds.Tables[0]));
            }

            return(lst);
        }