Beispiel #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);
        }
Beispiel #2
0
        public ActionResult FineContracts(List<ContractFineViewModel> models)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                List<Contract> listContract = new List<Contract>();
                if (models != null)
                {
                    foreach (ContractFineViewModel model in models)
                    {
                        Contract c = new Contract();
                        c.Id = model.ContractId;
                        c.FineAmount = model.FineAmount;
                        listContract.Add(c);
                    }
                }

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.FineContracts(listContract, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(models);
        }
Beispiel #3
0
        public ActionResult SubmitPrintContract(string id)
        {
            string strMessage;
            ContractSystem contract = new ContractSystem();
            bool bSuccess = contract.SubmitPrintContract(long.Parse(id), LoginAccountId, LoginStaffName, out strMessage);

            var ret = new
            {
                Success = bSuccess,
                Message = strMessage
            };
            return Json(ret);
        }
Beispiel #4
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);
     }
 }
Beispiel #5
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);
        }
Beispiel #6
0
        public JsonResult LoadSaveFinesGrid(string sidx, string sord, int page, int rows, string saveFines)
        {
            //读取数据
            List<Contract> listFineContract = new List<Contract>();
            if (saveFines != string.Empty)
            {
                string strErrText;
                ContractSystem contract = new ContractSystem();
                List<Contract> listContract = contract.LoadFineContractsByConditions(string.Empty, string.Empty, string.Empty, LoginAccountId, LoginStaffName, out strErrText);
                if (listContract == null)
                {
                    throw new Exception(strErrText);
                }

                //过滤数据
                string[] fines = saveFines.Split(',');
                foreach (string fine in fines)
                {
                    if (fine != string.Empty)
                    {
                        string[] s = fine.Split('|');
                        long nContractId = long.Parse(s[0]);
                        decimal decFineAmount = decimal.Parse(s[1]);

                        Contract o = listContract.Find(delegate(Contract c) { return c.Id == nContractId; });
                        if (o == null)
                        {
                            throw new Exception(InnoSoft.LS.Resources.Strings.FindFineContractDataFaild);
                        }
                        o.FineAmount = decFineAmount;
                        listFineContract.Add(o);
                    }
                }
            }

            //提取当前页面数据
            int nTotalRows = listFineContract.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "ContractNo") + " " + (sord ?? "ASC");
            var data = listFineContract.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from c in data
                      select new
                      {
                          id = c.Id,
                          cell = new string[] {
                              c.Id.ToString(),
                              c.ContractNo,
                              c.OriginalContractNo,
                              c.CarNo,
                              c.TrailerNo,
                              c.DriverName,
                              c.DriverMobileTel,
                              c.CreatorName,
                              c.FineAmount.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    ContractNo = InnoSoft.LS.Resources.Labels.Total,
                    FineAmount = data.Sum(s => s.FineAmount)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #7
0
        public JsonResult LoadContractDeliverPlansGrid(string sidx, string sord, int page, int rows, string contractId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<ContractDeliverPlan> listPlan = contract.LoadContractDeliverPlans(long.Parse(contractId), LoginAccountId, LoginStaffName, out strErrText);
            if (listPlan == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listPlan.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "PlanNo") + " " + (sord ?? "ASC");
            var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from p in data
                      select new
                      {
                          id = p.Id,
                          cell = new string[] {
                              p.Id.ToString(),
                              p.PlanId.ToString(),
                              p.PlanNo,
                              p.CustomerName,
                              p.ShipmentNo,
                              p.DeliveryNo,
                              p.ReceiverName,
                              p.ReceiverCity + p.ReceiverAddress,
                              p.ReceiveType,
                              p.PlanType,
                              p.Packages.ToString(),
                              p.Tunnages.ToString("#0.######"),
                              p.Piles.ToString("#0.######"),
                              p.TenThousands.ToString("#0.######"),
                              p.TransportPrice.ToString("#0.######"),
                              p.TransportCharges.ToString(),
                              p.Remark,
                              p.TransportChargeExpression,
                              p.TransportPriceExpression,
                              p.KM.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    PlanNo = InnoSoft.LS.Resources.Labels.Total,
                    Packages = data.Sum(s => s.Packages),
                    Tunnages = data.Sum(s => s.Tunnages),
                    Piles = data.Sum(s => s.Piles),
                    TenThousands = data.Sum(s => s.TenThousands),
                    TransportCharges = data.Sum(s => s.TransportCharges)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #8
0
        public JsonResult LoadApproveContractsOwnOrgansByTimespan(string startTime, string endTime)
        {
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<Organization> listOrgan = contract.LoadApproveContractsOwnOrgansByTimespan(startTime, endTime, LoginAccountId, LoginStaffName, out strErrText);
            if (listOrgan == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from o in listOrgan
                      select new
                      {
                          Id = o.Id.ToString(),
                          FullName = o.FullName
                      };

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #9
0
        public ActionResult ExportFines()
        {
            string strErrText;

            #region 提取参数

            var request = HttpContext.Request;
            string strStartTime = request.QueryString["startTime"] ?? string.Empty;
            string strEndTime = request.QueryString["endTime"] ?? string.Empty;
            string strCreatorId = request.QueryString["creatorId"] ?? string.Empty;

            #endregion

            #region 读取罚款数据

            ContractSystem contract = new ContractSystem();
            List<Contract> listContract = contract.LoadContractFinesByConditions(strStartTime, strEndTime, strCreatorId, LoginAccountId, LoginStaffName, out strErrText);
            if (listContract == null)
            {
                throw new Exception(strErrText);
            }

            #endregion

            #region 输出Excel

            //生成GridView
            BoundField colStaffName = new BoundField();
            colStaffName.HeaderText = InnoSoft.LS.Resources.Labels.StaffName;
            colStaffName.DataField = "CreatorName";

            BoundField colFineTime = new BoundField();
            colFineTime.HeaderText = InnoSoft.LS.Resources.Labels.FineTime;
            colFineTime.DataField = "FineTime";

            BoundField colContractNo = new BoundField();
            colContractNo.HeaderText = InnoSoft.LS.Resources.Labels.ContractNo;
            colContractNo.DataField = "ContractNo";

            BoundField colOriginalContractNo = new BoundField();
            colOriginalContractNo.HeaderText = InnoSoft.LS.Resources.Labels.OriginalContractNo;
            colOriginalContractNo.DataField = "OriginalContractNo";

            BoundField colFineAmount = new BoundField();
            colFineAmount.HeaderText = InnoSoft.LS.Resources.Labels.FineAmount;
            colFineAmount.DataField = "FineAmount";

            var grid = new GridView();
            grid.Columns.Add(colStaffName);
            grid.Columns.Add(colFineTime);
            grid.Columns.Add(colContractNo);
            grid.Columns.Add(colOriginalContractNo);
            grid.Columns.Add(colFineAmount);

            grid.AutoGenerateColumns = false;

            grid.DataSource = from c in listContract
                              select new
                              {
                                  CreatorName = c.CreatorName,
                                  FineTime = c.FineTime.ToString("yyyy-MM-dd"),
                                  ContractNo = c.ContractNo,
                                  OriginalContractNo = c.OriginalContractNo,
                                  FineAmount = c.FineAmount.ToString("N")
                              };
            grid.DataBind();

            //导出GridView
            Response.ClearContent();
            Response.Charset = InnoSoft.LS.Resources.Encoding.ExcelCharset;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(InnoSoft.LS.Resources.Encoding.ExcelContent);
            Response.ContentType = "application/ms-excel";
            Response.Write("<meta http-equiv=Content-Type content=text/html charset=" + InnoSoft.LS.Resources.Encoding.ExcelCharset + ">");
            Response.AddHeader("content-disposition", "attachment; filename=ContractFines.xls");
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            grid.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();

            #endregion

            return View("SearchFines");
        }
Beispiel #10
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);
        }
Beispiel #11
0
        public ActionResult ModifyContractGoods(ContractDeliverPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                ContractDeliverPlan data = new ContractDeliverPlan();
                data.Id = model.Id;
                data.ContractId = model.ContractId;
                data.DispatchBillId = model.DispatchBillId;
                data.PlanId = model.PlanId;
                data.Packages = model.Packages;
                data.Tunnages = model.Tunnages;
                data.Piles = model.Piles;
                data.TenThousands = model.TenThousands;
                data.TransportChargeExpression = model.TransportChargeExpression;
                data.TransportPriceExpression = model.TransportPriceExpression;
                data.KM = model.KM;
                data.TransportPrice = model.TransportPrice;
                data.TransportCharges = model.TransportCharges;
                data.Remark = model.Remark;

                List<ContractGoods> listGoods = new List<ContractGoods>();
                if (model.Goods != null)
                {
                    foreach (ContractGoodsViewModel m in model.Goods)
                    {
                        ContractGoods g = new ContractGoods();
                        g.DispatchBillId = model.DispatchBillId;
                        g.PlanId = model.PlanId;
                        g.GoodsId = m.GoodsId;
                        g.GoodsNo = m.GoodsNo;
                        g.BatchNo = m.BatchNo;
                        g.Packing = m.Packing;
                        g.Location = m.Location;
                        g.Packages = m.Packages;
                        g.PieceWeight = m.PieceWeight;
                        g.Tunnages = m.Tunnages;
                        g.Piles = m.Piles;
                        g.TenThousands = m.TenThousands;
                        g.ProductionDate = m.ProductionDate;
                        g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                        g.EnterWarehouseBillNo = m.EnterWarehouseBillNo;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.UpdateContractDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Beispiel #12
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);
        }
Beispiel #13
0
        public JsonResult LoadSearchContractReverseDetailsGrid(string sidx, string sord, int page, int rows, string reverseId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<ContractReverseDetail> listDetail = contract.LoadContractReverseDetailsByReverseId(long.Parse(reverseId), LoginAccountId, LoginStaffName, out strErrText);
            if (listDetail == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listDetail.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "ContractNo") + " " + (sord ?? "ASC");
            var data = listDetail.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from d in data
                      select new
                      {
                          id = d.Id,
                          cell = new string[] {
                              d.Id.ToString(),
                              d.ContractId.ToString(),
                              d.ContractNo,
                              d.OriginalContractNo,
                              d.GoodsName,
                              d.StartPlace,
                              d.DestPlace,
                              d.ShipmentTime.ToString("yyyy-MM-dd"),
                              d.CarNo,
                              d.TrailerNo,
                              d.DriverName,
                              d.DriverMobileTel,
                              d.TotalTunnages.ToString("#0.######"),
                              d.TotalPiles.ToString("#0.######"),
                              d.TotalTransportCharges.ToString(),
                              d.ReverseAmount.ToString(),
                              d.WithholdAmount.ToString(),
                              d.FactpaymentAmount.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    ContractNo = InnoSoft.LS.Resources.Labels.Total,
                    TotalTransportCharges = data.Sum(s => s.TotalTransportCharges),
                    ReverseAmount = data.Sum(s => s.ReverseAmount),
                    WithholdAmount = data.Sum(s => s.WithholdAmount),
                    FactpaymentAmount = data.Sum(s => s.FactpaymentAmount)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #14
0
        public JsonResult LoadSearchContractFinesGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string creatorId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<Contract> listContract = contract.LoadContractFinesByConditions(startTime, endTime, creatorId, LoginAccountId, LoginStaffName, out strErrText);
            if (listContract == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listContract.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "FineTime") + " " + (sord ?? "ASC");
            var data = listContract.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from c in data
                      select new
                      {
                          id = c.Id,
                          cell = new string[] {
                              c.Id.ToString(),
                              c.CreatorName,
                              c.FineTime.ToString("yyyy-MM-dd"),
                              c.ContractNo,
                              c.OriginalContractNo,
                              c.FineAmount.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    CreatorName = InnoSoft.LS.Resources.Labels.Total,
                    FineAmount = data.Sum(s => s.FineAmount)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #15
0
        public JsonResult LoadSaveReversesGrid(string sidx, string sord, int page, int rows, string saveReverses)
        {
            //读取数据
            List<Contract> listReverseContract = new List<Contract>();
            if (saveReverses != string.Empty)
            {
                //生成冲帐明细数据
                List<ContractReverseDetail> listReverseDetail = new List<ContractReverseDetail>();
                string[] reverses = saveReverses.Split(',');
                foreach (string reverse in reverses)
                {
                    if (reverse != string.Empty)
                    {
                        string[] s = reverse.Split('|');
                        ContractReverseDetail detail = new ContractReverseDetail();
                        detail.ContractId = long.Parse(s[0]);
                        detail.ReverseAmount = decimal.Parse(s[1]);
                        detail.WithholdAmount = decimal.Parse(s[2]);
                        detail.FactpaymentAmount = decimal.Parse(s[3]);
                        listReverseDetail.Add(detail);
                    }
                }

                //读取冲帐合同数据
                string strErrText;
                var strContractIds = string.Join(",", (from d in listReverseDetail select d.ContractId).ToArray<long>());
                ContractSystem contract = new ContractSystem();
                List<Contract> listContract = contract.LoadReverseContractsByContractIds(strContractIds, LoginAccountId, LoginStaffName, out strErrText);
                if (listContract == null)
                {
                    throw new Exception(strErrText);
                }

                //过滤数据
                foreach (ContractReverseDetail detail in listReverseDetail)
                {
                    Contract o = listContract.Find(delegate(Contract c) { return c.Id == detail.ContractId; });
                    if (o == null)
                    {
                        throw new Exception(InnoSoft.LS.Resources.Strings.FindReverseContractDataFaild);
                    }
                    o.ReverseAmount = detail.ReverseAmount;
                    o.WithholdAmount = detail.WithholdAmount;
                    o.FactpaymentAmount = detail.FactpaymentAmount;
                    listReverseContract.Add(o);
                }
            }

            //提取当前页面数据
            int nTotalRows = listReverseContract.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "ContractNo") + " " + (sord ?? "ASC");
            var data = listReverseContract.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from c in data
                      select new
                      {
                          id = c.Id,
                          cell = new string[] {
                              c.Id.ToString(),
                              c.ContractNo,
                              c.OriginalContractNo,
                              c.CarNo,
                              c.TrailerNo,
                              c.DriverName,
                              c.DriverMobileTel,
                              c.ReverseAmount.ToString(),
                              c.WithholdAmount.ToString(),
                              c.FactpaymentAmount.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    ContractNo = InnoSoft.LS.Resources.Labels.Total,
                    ReverseAmount = data.Sum(s => s.ReverseAmount),
                    WithholdAmount = data.Sum(s => s.WithholdAmount),
                    FactpaymentAmount = data.Sum(s => s.FactpaymentAmount)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #16
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);
        }
Beispiel #17
0
        public JsonResult LoadApproveContractsGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string contractNo, string originalContractNo, string destCountry, string destProvince, string destCity, string carNo, string organId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<Contract> listContract = contract.LoadApproveContractsByConditions(startTime, endTime, contractNo, originalContractNo, destCountry, destProvince, destCity, carNo, organId, LoginAccountId, LoginStaffName, out strErrText);
            if (listContract == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listContract.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "ShipmentTime") + " " + (sord ?? "DESC");
            var data = listContract.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from c in data
                      select new
                      {
                          id = c.Id,
                          cell = new string[] {
                              c.Id.ToString(),
                              c.ContractNo,
                              c.OriginalContractNo,
                              c.ShipmentTime.ToString("yyyy-MM-dd"),
                              c.CarNo,
                              c.TrailerNo,
                              c.CarType,
                              c.DriverName,
                              c.DriverMobileTel,
                              c.GoodsName,
                              c.TotalTunnages.ToString("#0.######"),
                              c.TotalPiles.ToString("#0.######"),
                              c.TotalTransportCharges.ToString()
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #18
0
 public ActionResult ReturnModifyContract(string id)
 {
     string strErrText;
     ContractSystem contract = new ContractSystem();
     if (contract.ReturnModifyContract(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText))
     {
         return Json(string.Empty);
     }
     else
     {
         return Json(strErrText);
     }
 }
Beispiel #19
0
        public JsonResult LoadContractApproveCommentsGrid(string sidx, string sord, int page, int rows, string contractId, string planId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<ContractApproveComment> listComment = contract.LoadContractApproveComments(long.Parse(contractId), long.Parse(planId), LoginAccountId, LoginStaffName, out strErrText);
            if (listComment == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listComment.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "ApproveTime") + " " + (sord ?? "ASC");
            var data = listComment.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from p in data
                      select new
                      {
                          id = p.Id,
                          cell = new string[] {
                              p.Id.ToString(),
                              p.ApproveTime.ToString("yyyy-MM-dd"),
                              p.ApproverName,
                              p.ApprovedTransportPrice.ToString("#0.######"),
                              p.ApprovedTransportCharges.ToString()
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #20
0
        public ActionResult ReverseContracts(ContractReverseViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                ContractReverse data = new ContractReverse();
                data.Id = model.Id;
                data.ReverseAmount = model.ReverseAmount;
                data.WithholdAmount = model.WithholdAmount;
                data.FactpaymentAmount = model.FactpaymentAmount;
                data.CreatorId = model.CreatorId;
                data.CreatorName = model.CreatorName;

                List<ContractReverseDetail> listDetail = new List<ContractReverseDetail>();
                if (model.Details != null)
                {
                    foreach (ContractReverseDetailViewModel m in model.Details)
                    {
                        ContractReverseDetail d = new ContractReverseDetail();
                        d.Id = m.Id;
                        d.ReverseId = 0;
                        d.ContractId = m.ContractId;
                        d.ReverseAmount = m.ReverseAmount;
                        d.WithholdAmount = m.WithholdAmount;
                        d.FactpaymentAmount = m.FactpaymentAmount;
                        listDetail.Add(d);
                    }
                }

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.InsertContractReverse(data, listDetail, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Beispiel #21
0
        public JsonResult LoadContractReverseDetailsGrid(string sidx, string sord, int page, int rows, string contractId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<ContractReverseDetail> listReverseDetail = contract.LoadContractReverseDetails(long.Parse(contractId), LoginAccountId, LoginStaffName, out strErrText);
            if (listReverseDetail == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listReverseDetail.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "CreateTime") + " " + (sord ?? "ASC");
            var data = listReverseDetail.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from d in data
                      select new
                      {
                          id = d.Id,
                          cell = new string[] {
                              d.Id.ToString(),
                              d.CreateTime.ToString("yyyy-MM-dd"),
                              d.CreatorName,
                              d.ReverseAmount.ToString(),
                              d.WithholdAmount.ToString(),
                              d.FactpaymentAmount.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    CreateTime = InnoSoft.LS.Resources.Labels.Total,
                    ReverseAmount = data.Sum(s => s.ReverseAmount),
                    WithholdAmount = data.Sum(s => s.WithholdAmount),
                    FactpaymentAmount = data.Sum(s => s.FactpaymentAmount)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #22
0
        public JsonResult LoadReverseContractsGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string contractNo, string originalContractNo, string carrierName, string carNo, string organId)
        {
            //读取数据
            string strErrText;
            ContractSystem contract = new ContractSystem();
            List<Contract> listContract = contract.LoadReverseContractsByConditions(startTime, endTime, contractNo, originalContractNo, carrierName, carNo, organId, LoginAccountId, LoginStaffName, out strErrText);
            if (listContract == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listContract.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "ContractNo") + " " + (sord ?? "ASC");
            var data = listContract.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from c in data
                      select new
                      {
                          id = c.Id,
                          cell = new string[] {
                              c.Id.ToString(),
                              c.ContractNo,
                              c.OriginalContractNo,
                              c.GoodsName,
                              c.StartPlace,
                              c.DestPlace,
                              c.ShipmentTime.ToString("yyyy-MM-dd"),
                              c.CarNo,
                              c.TrailerNo,
                              c.DriverName,
                              c.DriverMobileTel,
                              c.TotalTunnages.ToString("#0.######"),
                              c.TotalPiles.ToString("#0.######"),
                              c.TotalTransportCharges.ToString(),
                              c.PrepayTransportCharges.ToString(),
                              c.ResidualTransportCharges.ToString(),
                              c.ReverseAmount.ToString(),
                              (c.TotalTransportCharges - c.ReverseAmount).ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    ContractNo = InnoSoft.LS.Resources.Labels.Total,
                    TotalTransportCharges = data.Sum(s => s.TotalTransportCharges),
                    PrepayTransportCharges = data.Sum(s => s.PrepayTransportCharges),
                    ResidualTransportCharges = data.Sum(s => s.ResidualTransportCharges),
                    ReverseAmount = data.Sum(s => s.ReverseAmount),
                    ResidualReverseAmount = data.Sum(s => s.TotalTransportCharges - s.ReverseAmount)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }