发票管理增加打印,和推送oa
This commit is contained in:
@@ -3,13 +3,16 @@ using FineUIPro;
|
||||
using MiniExcelLibs;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Eval;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Org.BouncyCastle.Security;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using WIA;
|
||||
|
||||
@@ -108,7 +111,7 @@ namespace BLL
|
||||
where
|
||||
(string.IsNullOrEmpty(table.InvoiceId) || x.InvoiceId.Contains(table.InvoiceId)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractId) || x.ProjectId.Contains(table.ContractId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractId) || x.ContractId.Contains(table.ContractId)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceCode) || x.InvoiceCode.Contains(table.InvoiceCode)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceNumber) || x.InvoiceNumber.Contains(table.InvoiceNumber)) &&
|
||||
(string.IsNullOrEmpty(table.SellerName) || x.SellerName.Contains(table.SellerName)) &&
|
||||
@@ -174,9 +177,29 @@ namespace BLL
|
||||
});
|
||||
}
|
||||
|
||||
public static IEnumerable GetOrderInListData(Model.PHTGL_Invoice table, Grid grid1)
|
||||
|
||||
public static IEnumerable GetOrderInListData(Model.PHTGL_Invoice table, Grid grid1,string state)
|
||||
{
|
||||
var q = GetPHTGL_InvoiceByModle(table);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case "0": q = q.Where(x => x.State > StateDataIn); //全部
|
||||
break;
|
||||
case "1":
|
||||
q = q.Where(x => x.State > StateDataIn &&x.State< StateInPutApproveSuccess); //未入库
|
||||
break;
|
||||
case "2":
|
||||
q = q.Where(x => x.State >= StateInPutApproveSuccess ); //已入库
|
||||
break;
|
||||
case "3":
|
||||
q = q.Where(x => x.State >=StateInPutApproveSuccess && x.State < StateOutPutApproveSuccess);//未出库
|
||||
break;
|
||||
case "4":
|
||||
q = q.Where(x => x.State == StateOutPutApproveSuccess);//已出库
|
||||
break;
|
||||
|
||||
}
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
@@ -224,6 +247,60 @@ namespace BLL
|
||||
return Funs.DB.PHTGL_Invoice.FirstOrDefault(x => x.InvoiceId == InvoiceId);
|
||||
}
|
||||
|
||||
public static PHTGL_InvoicePrintModel GetPHTGL_InvoicePrintModel(string InvoiceId)
|
||||
{
|
||||
var result = new PHTGL_InvoicePrintModel();
|
||||
Order order = new Order();
|
||||
List<OrderDetail> orderDetails = new List<OrderDetail>();
|
||||
OrderApproveIn orderApproveIn = new OrderApproveIn();
|
||||
OrderApproveOut orderApproveOut = new OrderApproveOut();
|
||||
|
||||
var invoiceModel = GetPHTGL_InvoiceById(InvoiceId);
|
||||
var invoiceDetail = PhtglInvoicedetailService.GetPHTGL_InvoiceDetailByInvoiceId(InvoiceId);
|
||||
var approveManModels = GetInvoiceApproveManEntity(InvoiceId);
|
||||
//将invoiceModel 映射到order
|
||||
var mapper = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<PHTGL_Invoice, Order>();
|
||||
order=mapper.Map(invoiceModel);
|
||||
order.ProjectName=ProjectService.GetProjectNameByProjectId(invoiceModel.ProjectId);
|
||||
order.ContractCode=ContractService.GetContractById(invoiceModel.ContractId)?.ContractNum;
|
||||
//invoiceDetail 映射到orderDetails
|
||||
var mapper2 = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<List<PHTGL_InvoiceDetail>, List<OrderDetail>>();
|
||||
orderDetails = mapper2.Map(invoiceDetail);
|
||||
orderDetails= orderDetails.Select(x => new OrderDetail
|
||||
{
|
||||
GoodsOrServicesName = x.GoodsOrServicesName,
|
||||
SpecificationModel = x.SpecificationModel,
|
||||
Unit = x.Unit,
|
||||
Quantity = x.Quantity,
|
||||
UnitPrice = x.UnitPrice,
|
||||
NoTaxPrice = x.Amount - x.Tax,
|
||||
TaxRate = string.Format("{0:P0}", Convert.ToDecimal(x.TaxRate) ),
|
||||
Tax =x.Tax ,
|
||||
Amount = x.Amount,
|
||||
}).ToList();
|
||||
if (approveManModels!=null)
|
||||
{
|
||||
orderApproveIn.ProjectManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ProjectManager) : "";
|
||||
orderApproveIn.ControlManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ControlManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ControlManager) : "";
|
||||
orderApproveIn.ConstructionManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ConstructionManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ConstructionManager) : "";
|
||||
orderApproveIn.ProfessionalEngineer = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ProfessionalEngineer) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ProfessionalEngineer) : "";
|
||||
|
||||
orderApproveOut.ProjectManager = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ProjectManager) : "";
|
||||
orderApproveOut.ControlManager = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ControlManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ControlManager) : "";
|
||||
orderApproveOut.PurchasingMan = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.PurchasingMan) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.PurchasingMan) : "";
|
||||
orderApproveOut.ConUnitMaterialOfficer = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ConUnitMaterialOfficer) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ConUnitMaterialOfficer) : "";
|
||||
orderApproveOut.ConUnitProjectManager = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ConUnitProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ConUnitProjectManager) : "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
result.Order = order;
|
||||
result.Data = orderDetails;
|
||||
result.ApproveIn = orderApproveIn;
|
||||
result.ApproveOut = orderApproveOut;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加实体
|
||||
/// </summary>
|
||||
@@ -518,6 +595,7 @@ namespace BLL
|
||||
_Approve.State = 0;
|
||||
_Approve.IsAgree = 0;
|
||||
_Approve.ApproveIdea = "";
|
||||
_Approve.IsPushOa = 0;
|
||||
_Approve.ApproveType = approveManModels.Rolename;
|
||||
_Approve.ApproveForm =(type==0? "Invoice_Input": "Invoice_Output");
|
||||
BLL.PHTGL_ApproveService.AddPHTGL_Approve(_Approve);
|
||||
@@ -580,6 +658,8 @@ namespace BLL
|
||||
model.State = (type == 0 ? StateInPutApproveRefuse : StateOutPutApproveRefuse);
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
OAWebSevice.Pushoa();
|
||||
OAWebSevice.DoneRequest(thisApprovemodel.ApproveId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user