发票管理增加打印,和推送oa

This commit is contained in:
2024-05-12 20:12:30 +08:00
parent 251422813e
commit 8634720b08
23 changed files with 1959 additions and 41 deletions
@@ -1,6 +1,9 @@
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
@@ -18,6 +21,11 @@ namespace FineUIPro.Web.PHTGL.InvoiceManage
{
this.GetButtonPower();
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
this.DropContractCode.DataTextField = "ContractNum";
this.DropContractCode.DataValueField = "ContractId";
this.DropContractCode.DataSource = BLL.PHTGL_ContractReviewService.GetContractReview_CompleteData(this.CurrUser.LoginProjectId);
this.DropContractCode.DataBind();
Funs.FineUIPleaseSelect(DropContractCode);
// 绑定表格
this.BindGrid();
}
@@ -31,7 +39,11 @@ namespace FineUIPro.Web.PHTGL.InvoiceManage
{
Model.PHTGL_Invoice table = new Model.PHTGL_Invoice();
table.ProjectId = this.CurrUser.LoginProjectId;
var tb = BLL.PhtglInvoiceService.GetOrderInListData(table, Grid1);
if( DropContractCode.SelectedValue!=Const._Null)
{
table.ContractId = this.DropContractCode.SelectedValue;
}
var tb = BLL.PhtglInvoiceService.GetOrderInListData(table, Grid1,drpStates.SelectedValue);
Grid1.RecordCount = PhtglInvoiceService.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
Grid1.DataSource = tb;
@@ -193,7 +205,15 @@ namespace FineUIPro.Web.PHTGL.InvoiceManage
{
Window1.Title = "出库单详情";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InvoiceOrderDetail.aspx?InvoiceId={0}&&Type={1}", e.RowID, "1", "编辑 - ")));
}
}
else if (e.CommandName == "OrderInDetailPrint")
{
Print(e.RowID,"0");
}
else if (e.CommandName == "OrderOutDetailPrint")
{
Print(e.RowID, "1");
}
}
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
@@ -203,13 +223,92 @@ namespace FineUIPro.Web.PHTGL.InvoiceManage
if (model.State> PhtglInvoiceService.StateDataIn)
{
Grid1.FindColumn("btnOrderInDetail").Hidden = false;
Grid1.FindColumn("btnOrderInDetailPrint").Hidden = false;
}
if (model.State >= PhtglInvoiceService.StateInPutApproveSuccess)
{
Grid1.FindColumn("btnOrderOutDetail").Hidden = false;
Grid1.FindColumn("btnOrderOutDetailPrint").Hidden = false;
}
}
private void Print(string Id,string Type)
{
BLL.FastReportService.ResetData();
if (string.IsNullOrEmpty(Id))
{
ShowNotify("请选择要打印的项", MessageBoxIcon.Warning);
return;
}
var printModel= PhtglInvoiceService.GetPHTGL_InvoicePrintModel(Id);
List<Order> orders = new List<Order>();
orders.Add(printModel.Order);
DataTable Table1 = LINQToDataTable(orders);
if (Table1 != null)
{
Table1.TableName = "Table1";
}
DataTable Data = LINQToDataTable(printModel.Data);
if (Data != null)
{
Data.TableName = "Data";
}
List<OrderApproveIn> orderApproveIns = new List<OrderApproveIn>();
orderApproveIns.Add(printModel.ApproveIn);
DataTable ApproveInData = LINQToDataTable(orderApproveIns);
if (ApproveInData != null)
{
ApproveInData.TableName = "ApproveInData";
}
List<OrderApproveOut> orderApproveOuts = new List<OrderApproveOut>();
orderApproveOuts.Add(printModel.ApproveOut);
DataTable ApproveOutData = LINQToDataTable(orderApproveOuts);
if (ApproveOutData != null)
{
ApproveOutData.TableName = "ApproveOutData";
}
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("AmountInWords", Funs.NumericCapitalization(printModel.Data.Sum(p => p.Amount)));
BLL.FastReportService.AddFastreportTable(Table1);
BLL.FastReportService.AddFastreportTable(Data);
BLL.FastReportService.AddFastreportTable(ApproveInData);
BLL.FastReportService.AddFastreportTable(ApproveOutData);
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
if (Type=="0")
{
initTemplatePath = "File\\Fastreport\\发票存货入库单.frx";
}
else
{
initTemplatePath = "File\\Fastreport\\发票存货出库单.frx";
}
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
#region
/// <summary>
/// 查询按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
}
}