예제 #1
0
        public ActionResult ApproveContract(ContractViewModel model)
        {
            //创建数据
            List<ContractDeliverPlan> listPlan = new List<ContractDeliverPlan>();
            if (model.DeliverPlans != null)
            {
                foreach (ContractDeliverPlanViewModel m in model.DeliverPlans)
                {
                    ContractDeliverPlan p = new ContractDeliverPlan();
                    p.Id = m.Id;
                    p.ContractId = m.ContractId;
                    p.PlanId = m.PlanId;
                    p.Packages = m.Packages;
                    p.Tunnages = m.Tunnages;
                    p.Piles = m.Piles;
                    p.TenThousands = m.TenThousands;
                    p.TransportChargeExpression = m.TransportChargeExpression;
                    p.TransportPriceExpression = m.TransportPriceExpression;
                    p.KM = m.KM;
                    p.TransportPrice = m.TransportPrice;
                    p.TransportCharges = m.TransportCharges;
                    p.ApprovedTransportPrice = m.ApprovedTransportPrice;
                    p.ApprovedTransportCharges = m.ApprovedTransportCharges;
                    listPlan.Add(p);
                }
            }

            //保存数据
            string strMessage;
            ContractSystem contract = new ContractSystem();
            bool bSuccess = contract.ApproveContract(model.Id, listPlan, LoginAccountId, LoginStaffName, out strMessage);

            var ret = new
            {
                Success = bSuccess,
                Message = strMessage
            };
            return Json(ret);
        }
예제 #2
0
 public ActionResult SubmitContract(ContractViewModel model)
 {
     string strErrText;
     ContractSystem contract = new ContractSystem();
     if (contract.SubmitContract(model.Id, LoginAccountId, LoginStaffName, out strErrText))
     {
         return Json(string.Empty);
     }
     else
     {
         return Json(strErrText);
     }
 }
예제 #3
0
        public ActionResult SubmitContract(string id)
        {
            string strErrText;

            //读取合同数据
            ContractSystem contract = new ContractSystem();
            Contract data = contract.LoadContract(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //创建Model
            ContractViewModel model = new ContractViewModel();
            model.Id = data.Id;
            model.DispatchBillId = data.DispatchBillId;
            model.ContractNo = data.ContractNo;
            model.CarNo = data.CarNo;
            model.TrailerNo = data.TrailerNo;
            model.DriverName = data.DriverName;
            model.DriverLicenseNo = data.DriverLicenseNo;
            model.DriverMobileTel = data.DriverMobileTel;
            model.DriverHomeTel = data.DriverHomeTel;
            model.CarrierId = data.CarrierId;
            model.CarrierName = data.CarrierName;
            model.GoodsName = data.GoodsName;
            model.Packing = data.Packing;
            model.StartPlace = data.StartPlace;
            model.DestPlace = data.DestPlace;
            model.ShipmentTime = data.ShipmentTime.ToString("yyyy-MM-dd");
            model.ArrivalTime = data.ArrivalTime.ToString("yyyy-MM-dd");
            model.TotalPackages = data.TotalPackages;
            model.TotalTunnages = data.TotalTunnages;
            model.TotalPiles = data.TotalPiles;
            model.TotalTenThousands = data.TotalTenThousands;
            model.TotalTransportCharges = data.TotalTransportCharges;
            model.PrepayTransportCharges = data.PrepayTransportCharges;
            model.ResidualTransportCharges = data.ResidualTransportCharges;
            model.OriginalContractNo = data.OriginalContractNo;

            return View(model);
        }
예제 #4
0
        public ActionResult PrintContract(string id)
        {
            string strErrText;

            //读取公司名称
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrgan = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrgan == null)
            {
                throw new Exception(strErrText);
            }
            Organization root = listOrgan.Find(delegate(Organization o) { return o.ParentId == 0; });
            ViewData["CompanyName"] = root.Name;

            //读取合同数据
            ContractSystem contract = new ContractSystem();
            Contract data = contract.LoadContract(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //创建Model
            ContractViewModel model = new ContractViewModel();
            model.Id = data.Id;
            model.DispatchBillId = data.DispatchBillId;
            model.ContractNo = data.ContractNo;
            model.CarNo = data.CarNo;
            model.TrailerNo = data.TrailerNo;
            model.DriverName = data.DriverName;
            model.DriverLicenseNo = data.DriverLicenseNo;
            model.DriverMobileTel = data.DriverMobileTel;
            model.DriverHomeTel = data.DriverHomeTel;
            model.CarrierId = data.CarrierId;
            model.CarrierName = data.CarrierName;
            model.GoodsName = data.GoodsName;
            model.Packing = data.Packing;
            model.StartPlace = data.StartPlace;
            model.DestPlace = data.DestPlace;
            model.ShipmentTime = data.ShipmentTime.ToString("yyyy-MM-dd");
            model.ArrivalTime = data.ArrivalTime.ToString("yyyy-MM-dd");
            model.TotalPackages = data.TotalPackages;
            model.TotalTunnages = data.TotalTunnages;
            model.TotalPiles = data.TotalPiles;
            model.TotalTenThousands = data.TotalTenThousands;
            model.TotalTransportCharges = data.TotalTransportCharges;
            model.PrepayTransportCharges = data.PrepayTransportCharges;
            model.ResidualTransportCharges = data.ResidualTransportCharges;
            model.OriginalContractNo = data.OriginalContractNo;

            return View(model);
        }
예제 #5
0
        public ActionResult NewContract(ContractViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Contract data = new Contract();
                data.DispatchBillId = model.DispatchBillId;
                data.CarNo = model.CarNo;
                data.TrailerNo = model.TrailerNo;
                data.CarType = model.CarType;
                data.DriverName = model.DriverName;
                data.DriverLicenseNo = model.DriverLicenseNo;
                data.DriverMobileTel = model.DriverMobileTel;
                data.DriverHomeTel = model.DriverHomeTel;
                data.CarrierId = model.CarrierId;
                data.CarrierName = model.CarrierName;
                data.GoodsName = model.GoodsName;
                data.Packing = model.Packing;
                data.StartPlace = model.StartPlace;
                data.DestPlace = model.DestPlace;
                data.ShipmentTime = DateTime.Parse(model.ShipmentTime);
                data.ArrivalTime = DateTime.Parse(model.ArrivalTime);
                data.TotalPackages = model.TotalPackages;
                data.TotalTunnages = model.TotalTunnages;
                data.TotalPiles = model.TotalPiles;
                data.TotalTenThousands = model.TotalTenThousands;
                data.TotalTransportCharges = model.TotalTransportCharges;
                data.PrepayTransportCharges = model.PrepayTransportCharges;
                data.ResidualTransportCharges = model.ResidualTransportCharges;
                data.OriginalContractNo = model.OriginalContractNo;
                data.IsPrestowage = true;

                List<ContractDeliverPlan> listPlan = new List<ContractDeliverPlan>();
                if (model.DeliverPlans != null)
                {
                    foreach (ContractDeliverPlanViewModel m in model.DeliverPlans)
                    {
                        ContractDeliverPlan p = new ContractDeliverPlan();
                        p.PlanId = m.PlanId;
                        p.Packages = m.Packages;
                        p.Tunnages = m.Tunnages;
                        p.Piles = m.Piles;
                        p.TenThousands = m.TenThousands;
                        p.TransportChargeExpression = m.TransportChargeExpression;
                        p.TransportPriceExpression = m.TransportPriceExpression;
                        p.KM = m.KM;
                        p.TransportPrice = m.TransportPrice;
                        p.TransportCharges = m.TransportCharges;
                        p.Remark = m.Remark;
                        listPlan.Add(p);
                    }
                }

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.InsertContract(data, listPlan, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
예제 #6
0
        public ActionResult ModifyContract(ContractViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Contract data = new Contract();
                data.Id = model.Id;
                data.DispatchBillId = model.DispatchBillId;
                data.ContractNo = model.ContractNo;
                data.CarNo = model.CarNo;
                data.TrailerNo = model.TrailerNo;
                data.CarType = model.CarType;
                data.DriverName = model.DriverName;
                data.DriverLicenseNo = model.DriverLicenseNo;
                data.DriverMobileTel = model.DriverMobileTel;
                data.DriverHomeTel = model.DriverHomeTel;
                data.CarrierId = model.CarrierId;
                data.CarrierName = model.CarrierName;
                data.GoodsName = model.GoodsName;
                data.Packing = model.Packing;
                data.StartPlace = model.StartPlace;
                data.DestPlace = model.DestPlace;
                data.ShipmentTime = DateTime.Parse(model.ShipmentTime);
                data.ArrivalTime = DateTime.Parse(model.ArrivalTime);
                data.TotalPackages = model.TotalPackages;
                data.TotalTunnages = model.TotalTunnages;
                data.TotalPiles = model.TotalPiles;
                data.TotalTenThousands = model.TotalTenThousands;
                data.TotalTransportCharges = model.TotalTransportCharges;
                data.PrepayTransportCharges = model.PrepayTransportCharges;
                data.ResidualTransportCharges = model.ResidualTransportCharges;
                data.OriginalContractNo = model.OriginalContractNo;

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.UpdateContract(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }