Ejemplo n.º 1
0
        public static List <DealerInfoVM> LoginRequest(string user, string pass, ref string msg)
        {
            SysFunction myFunc = new SysFunction();

            string json             = "";
            var    Serializer       = new JavaScriptSerializer();
            List <DealerInfoVM> lst = new List <DealerInfoVM>();

            try
            {
                DataTable dt = myFunc.GetDatas("select A.DealerCode,A.UserID ,A.UserName,A.ID,B.DealerDesc,B.Address1 ,B.Address2,B.Address3,B.Email,B.Fax,B.Phone1 ,B.NTN,B.Phone2,B.SaleTaxNo,B.Image,B.Logo,C.EmpCode,C.EmpName from SecurityUser A inner join DealerEmp C On A.DealerCode = C.DealerCode and C.EmpCode = A.EmpCode inner join Dealer B On A.DealerCode=B.DealerCode  where A.UserName = '******' and A.Password='******' And A.Active='Y'", "BMS0517ConnectionString", ref msg);
                if (dt == null)
                {
                    msg = msg + "  Invalid Connection Please Contact to Administrator";
                    return(lst);
                }

                if (dt.Rows.Count > 0)
                {
                    lst  = EnumerableExtension.ToList <DealerInfoVM>(dt);
                    json = Serializer.Serialize(lst);
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(lst);
        }
Ejemplo n.º 2
0
        public static string Get_DelChkList(string dealerCode)
        {
            string json       = "";
            var    Serializer = new JavaScriptSerializer();
            List <DeliveryCheckListVM> lst = new List <DeliveryCheckListVM>();

            try
            {
                string sql = "Select A.DelChkListCode , A.DelChkListDesc , A.OptFlag from DelChkList A where A.DealerCode = '" + dealerCode + "'";

                dt = sysfun.GetDatas(sql, "DMIS");

                if (dt.Rows.Count > 0)
                {
                    lst = EnumerableExtension.ToList <DeliveryCheckListVM>(dt);
                }
                json = Serializer.Serialize(lst);
            }
            catch (Exception ex)
            {
                throw;
            }

            return(json);
        }
Ejemplo n.º 3
0
        public static string Get_VehicleTypeData(string dealerCode)
        {
            string json              = "";
            var    Serializer        = new JavaScriptSerializer();
            List <VehicleTypeVM> lst = new List <VehicleTypeVM>();

            try
            {
                string sql = "Select V.VehTypeCode , V.VehTypeDesc , VehCategory from VehicleType V where V.DealerCode = '" + "COMON" + "'";

                dt = sysfun.GetDatas(sql, "BMS0517ConnectionString");

                if (dt.Rows.Count > 0)
                {
                    lst = EnumerableExtension.ToList <VehicleTypeVM>(dt);
                }
                json = Serializer.Serialize(lst);
            }
            catch (Exception ex)
            {
                throw;
            }

            return(json);
        }
Ejemplo n.º 4
0
        //csi end
        public ActionResult VoucherMain(string leadId = "", string type = "", string VouchNo = "", string ChassisNo = "")
        {
            Session["Formtype"] = type;

            DataTable dt  = new DataTable();
            string    msg = "";

            if (string.IsNullOrEmpty((string)Session["DealerCode"]))
            {
                return(RedirectToAction("NewLogin", "Home"));
            }
            dealerCode = Session["DealerCode"].ToString();
            if (string.IsNullOrEmpty((string)Session["VoucherNo"]))
            {
                Session["VoucherNo"] = "";
            }
            VouchNo = Session["VoucherNo"].ToString();
            List <SelectListItem> ddljournalNo = new List <SelectListItem>();

            ddljournalNo    = VoucherMethods.initializeDDLs(Session["DealerCode"].ToString());
            ViewBag.Journal = ddljournalNo;

            ViewBag.VoucherNo = VoucherMethods.GetNewVoucherNo("GVouMaster", "VouchNo", 3, Session["DealerCode"].ToString());

            List <VoucherVM> lstAccount = new List <VoucherVM>();

            string voucheNo = "";



            if (type == "ASC")
            {
                voucheNo = sys.GetStringValuesAgainstCodes("ReceiptNo", leadId, "VoucherNo", "ReceiptMaster", "", Session["DealerCode"].ToString());
            }
            else if (type == "CSI")
            {
                voucheNo = sys.GetStringValuesAgainstCodes("TransCode", leadId, "VoucherNo", "VehicleSaleMaster", "", Session["DealerCode"].ToString());
            }
            else if (type == "VReceipt")
            {
                voucheNo = sys.GetStringValuesAgainstCodes("RecNo", leadId, "VoucherNo", "ProdRecMaster", "", Session["DealerCode"].ToString());
            }
            else if (type == "BO")
            {
                voucheNo = sys.GetStringValuesAgainstCodes("BookRefNo", leadId, "VoucherNo", "BookOrdMaster", "", Session["DealerCode"].ToString());
            }
            else if (type == "PR")
            {
                voucheNo = sys.GetStringValuesAgainstCodes("ReceiptNo", leadId, "VoucherNo", "PaymentReceiptMaster", "", Session["DealerCode"].ToString());
            }
            if (voucheNo != "")
            {
                ViewBag.Text = "Edit";
                // ViewBag.VoucherNo = voucheNo;

                //lstAccount = VoucherMethods.LoadVoucher(voucheNo, Session["DealerCode"].ToString());

                //ViewBag.InstNo = lstAccount.ElementAt(1).InstrumentNo;
                //ViewBag.InstDate = lstAccount.ElementAt(1).InstrumentDate;
                if (type == "CSI")
                {
                    ViewBag.VoucherNo = voucheNo;

                    lstAccount = VoucherMethods.LoadCSI(leadId, Session["DealerCode"].ToString(), ChassisNo);

                    ViewBag.InstNo   = lstAccount.ElementAt(1).InstrumentNo;
                    ViewBag.InstDate = lstAccount.ElementAt(1).InstrumentDate;
                }
                else if (type == "ASC")
                {
                    ViewBag.VoucherNo = voucheNo;
                    lstAccount        = VoucherMethods.LoadCSGrid(leadId, Session["DealerCode"].ToString());

                    dt = sys.GetDatas("Select isnull(InstrumentNo,'') InstrumentNo, isnull(Convert(varchar(10),InstrumentDate,105),'') InstrumentDate From [ReceiptDetail] Where ReceiptNo = '" + leadId + "' AND [DealerCode] = '" + Session["DealerCode"].ToString() + "'", "BMS0517ConnectionString");
                    if (dt.Rows.Count > 0)
                    {
                        ViewBag.InstNo   = dt.Rows[0]["InstrumentNo"].ToString();
                        ViewBag.InstDate = dt.Rows[0]["InstrumentDate"].ToString();
                    }
                }
                else if (type == "VReceipt")
                {
                    ViewBag.VoucherNo = voucheNo;

                    lstAccount = VoucherMethods.LoadVehicleReceiptGrid(leadId, Session["DealerCode"].ToString(), ChassisNo);

                    ViewBag.InstNo   = lstAccount.ElementAt(1).InstrumentNo;
                    ViewBag.InstDate = lstAccount.ElementAt(1).InstrumentDate;
                }
                else if (type == "BO")
                {
                    ViewBag.VoucherNo = voucheNo;

                    lstAccount = VoucherMethods.LoadBookingOrderGrid(leadId, Session["DealerCode"].ToString(), ChassisNo);

                    ViewBag.InstNo   = lstAccount.ElementAt(1).InstrumentNo;
                    ViewBag.InstDate = lstAccount.ElementAt(1).InstrumentDate;
                }
                else if (type == "PR")
                {
                    ViewBag.VoucherNo = voucheNo;

                    lstAccount = VoucherMethods.LoadBookingOrderGrid(leadId, Session["DealerCode"].ToString(), ChassisNo);

                    ViewBag.InstNo   = lstAccount.ElementAt(1).InstrumentNo;
                    ViewBag.InstDate = lstAccount.ElementAt(1).InstrumentDate;
                }
            }
            else
            {
                ViewBag.Text = "Add";

                if (type == "DE")
                {
                    lstAccount = VoucherMethods.LoadDEGrid(leadId, Session["DealerCode"].ToString());
                    dt         = sys.GetDatas("Select isnull(InsNo,'') InstrumentNo, isnull(Convert(varchar(10),InsDate,105),'') InstrumentDate From [DailyExpenseMaster] Where ExpInvNo = '" + leadId + "' AND [DealerCode] = '" + Session["DealerCode"].ToString() + "'", "BMS0517ConnectionString");
                    if (dt.Rows.Count > 0)
                    {
                        ViewBag.InstNo   = dt.Rows[0]["InstrumentNo"].ToString();
                        ViewBag.InstDate = dt.Rows[0]["InstrumentDate"].ToString();
                    }
                }
                else if (type == "CSI")
                {
                    lstAccount = VoucherMethods.LoadCSI(leadId, Session["DealerCode"].ToString(), ChassisNo);

                    //dt = sys.GetData("Select isnull(InstrumentNo,'') InstrumentNo, isnull(Convert(varchar(10),InstrumentDate,105),'') InstrumentDate From [ReceiptDetail] Where ReceiptNo = '" + leadId + "' AND [DealerCode] = '" + Session["DealerCode"].ToString() + "'", "BMS0517ConnectionString");
                    //if (dt.Rows.Count > 0)
                    //{
                    //    ViewBag.InstNo = dt.Rows[0]["InstrumentNo"].ToString();
                    //    ViewBag.InstDate = dt.Rows[0]["InstrumentDate"].ToString();
                    //}
                }
                else if (type == "VReceipt")
                {
                    lstAccount = VoucherMethods.LoadVehicleReceiptGrid(leadId, Session["DealerCode"].ToString(), ChassisNo);
                }
                else if (type == "BO")
                {
                    lstAccount = VoucherMethods.LoadBookingOrderGrid(leadId, Session["DealerCode"].ToString(), ChassisNo);
                }
                else if (type == "PR")
                {
                    lstAccount = VoucherMethods.LoadPRGrid(leadId, Session["DealerCode"].ToString(), ChassisNo);
                }
                else
                {
                    lstAccount = VoucherMethods.LoadCSGrid(leadId, Session["DealerCode"].ToString());

                    dt = sys.GetDatas("Select isnull(InstrumentNo,'') InstrumentNo, isnull(Convert(varchar(10),InstrumentDate,105),'') InstrumentDate From [ReceiptDetail] Where ReceiptNo = '" + leadId + "' AND [DealerCode] = '" + Session["DealerCode"].ToString() + "'", "BMS0517ConnectionString");
                    if (dt.Rows.Count > 0)
                    {
                        ViewBag.InstNo   = dt.Rows[0]["InstrumentNo"].ToString();
                        ViewBag.InstDate = dt.Rows[0]["InstrumentDate"].ToString();
                    }
                }
            }

            ViewBag.lstAccount = lstAccount;

            double debit  = 0;
            double credit = 0;

            foreach (var item in lstAccount)
            {
                debit  = debit + double.Parse(item.Debit);
                credit = credit + double.Parse(item.Credit);
            }

            ViewBag.Debit  = debit;
            ViewBag.Credit = credit;

            return(View());
        }
Ejemplo n.º 5
0
        public static bool Insert_ReceiptDetail(List <ReceiptDetailVM> model2, ref string msg)
        {
            int count = 1;

            DataTable dt = new DataTable();

            dt = sysfun.GetDatas("Select BrandCode , ProdCode , VersionCode ,ColorCode, ColorDesc from VehicleSaleDetail where ChassisNo = '" + ChasisNo + "' or EngineNo = '" + EngineNo + "'", "BMS0517ConnectionString");

            try
            {
                foreach (var item in model2)
                {
                    if (item.InstrumentTypeCode != null || item.InstrumentNo != null)
                    {
                        SqlParameter[] param2 =
                        {
                            new SqlParameter("@DealerCode",          item.DealerCode),
                            new SqlParameter("@ReceiptNo",           strAutoCode),
                            new SqlParameter("@ReceiptDate",         sysfun.SaveDate(item.ReceiptDate)),
                            new SqlParameter("@InstrumentTypeCode",  item.InstrumentTypeCode),
                            new SqlParameter("@InstrumentNo",        item.InstrumentNo),
                            new SqlParameter("@InstrumentDate",      item.InstrumentDate == null ? DBNull.Value : sysfun.SaveDate(item.InstrumentDate)),
                            new SqlParameter("@CityCode",            item.CityCode),
                            new SqlParameter("@BankCode",            item.BankCode),
                            new SqlParameter("@Branch",              item.Branch),
                            new SqlParameter("@DrawnBankCode",       DBNull.Value),
                            new SqlParameter("@DrawnBranch",         DBNull.Value),
                            new SqlParameter("@CusCode",             item.CusCode),
                            new SqlParameter("@AccountCode",         DBNull.Value),
                            new SqlParameter("@ReceiptAmount",       item.ReceiptAmount),
                            new SqlParameter("@AdjustedAmount",      DBNull.Value),
                            new SqlParameter("@AdjustableAmount",    DBNull.Value),
                            new SqlParameter("@InvoiceNo",           item.InvoiceNo),
                            new SqlParameter("@ISFullAndFinal",      'N'),
                            new SqlParameter("@ISPenalty",           'N'),
                            new SqlParameter("@CreateDate",          DateTime.Now),
                            new SqlParameter("@CreateTime",          DateTime.Now),
                            new SqlParameter("@CreatedBy",           AuthBase.UserId),
                            new SqlParameter("@CreatedTerm",         General.CurrentIP),
                            new SqlParameter("@UpdDate",             DateTime.Now),
                            new SqlParameter("@UpdTime",             DateTime.Now),
                            new SqlParameter("@UpdUser",             AuthBase.UserId),
                            new SqlParameter("@UpdTerm",             General.CurrentIP),
                            new SqlParameter("@BookRefNo",           DBNull.Value),
                            new SqlParameter("@ProdCode",            dt.Rows[0]["ProdCode"].ToString()),
                            new SqlParameter("@VersionCode",         dt.Rows[0]["ProdCode"].ToString()),
                            new SqlParameter("@ColorDesc",           dt.Rows[0]["ColorDesc"].ToString()),
                            new SqlParameter("@ProdDesc",            sysfun.GetStringValuesAgainstCodes("ProdCode",                                     dt.Rows[0]["ProdCode"].ToString(),"ProdDesc", "Vehicle", "", item.DealerCode)),
                            new SqlParameter("@EmpCode",             DBNull.Value),
                            new SqlParameter("@EmpDesc",             DBNull.Value),
                            new SqlParameter("@TransferStatus",      'C'),
                            new SqlParameter("@SNO",                 count++),
                            new SqlParameter("@DepositSlipNo",       DBNull.Value),
                            new SqlParameter("@RealizeDate",         DBNull.Value),
                            new SqlParameter("@Status",              'R'),
                            new SqlParameter("@RefundNo",            DBNull.Value),
                            new SqlParameter("@PlanCode",            DBNull.Value),
                            new SqlParameter("@SlipRefNo",           DBNull.Value),
                            new SqlParameter("@ColorCode",           dt.Rows[0]["ColorCode"].ToString()),
                            new SqlParameter("@VehExpCode",          item.VehExpCode),
                            new SqlParameter("@ServicesAccountCode", item.ServicesAccountCode),
                            new SqlParameter("@BrandCode",           dt.Rows[0]["BrandCode"].ToString())
                        };


                        if (sysfun.ExecuteSP_NonQuery("SP_Insert_ReceiptDetail", param2, Trans) == true)
                        {
                            IsSaved = true;
                        }
                        else
                        {
                            ObjTrans.RollBackTransaction(ref Trans);
                            IsSaved = false;
                        }

                        IsSaved = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ObjTrans.RollBackTransaction(ref Trans);
                //throw;
                msg = ex.Message;
            }
            ObjTrans.CommittTransaction(ref Trans);
            return(IsSaved);
        }