发票管理增加打印,和推送oa
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Mobile.PHTGL.InvoiceManage
|
||||
{
|
||||
public partial class InvoiceOrderDetail : PageBase
|
||||
{
|
||||
public string InvoiceId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["InvoiceId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["InvoiceId"] = value;
|
||||
}
|
||||
}
|
||||
public string Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Type"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Type"] = value;
|
||||
}
|
||||
}
|
||||
public string PersonId
|
||||
{
|
||||
get
|
||||
{
|
||||
PersonId = Request.Params["PersonId"];
|
||||
return (string)ViewState["PersonId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PersonId"] = value;
|
||||
}
|
||||
}
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InvoiceId = Request.QueryString["InvoiceId"];
|
||||
Type = Request.QueryString["Type"];
|
||||
|
||||
Model.PHTGL_Invoice table = new Model.PHTGL_Invoice();
|
||||
table.InvoiceId = InvoiceId;
|
||||
var invoiceModel = BLL.PhtglInvoiceService.GetPHTGL_InvoiceById(InvoiceId);
|
||||
var ContractModel = BLL.ContractService.GetContractById(invoiceModel.ContractId);
|
||||
|
||||
if (invoiceModel != null)
|
||||
{
|
||||
txtProjectName.Text = ProjectService.GetProjectNameByProjectId(invoiceModel.ProjectId);
|
||||
txtContractNum.Text = ContractModel?.ContractNum;
|
||||
txtSellerName.Text = invoiceModel.SellerName;
|
||||
txtOrderInDate.SelectedDate = invoiceModel.OrderInDate;
|
||||
txtInvoiceDate.Text = invoiceModel.InvoiceDate;
|
||||
txtOrderCode.Text = invoiceModel.OrderCode;
|
||||
txtInvoiceNumber.Text = invoiceModel.InvoiceNumber;
|
||||
txtOrderOutDate.SelectedDate = invoiceModel.OrderOutDate;
|
||||
txtMaterialRequisitionUnit.Text = invoiceModel.MaterialRequisitionUnit;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindApproveData();
|
||||
if (Type == "0")
|
||||
{
|
||||
Grid1.Title = "入库单列表";
|
||||
PanelOrderIn.Hidden = false;
|
||||
}
|
||||
else if (Type == "1")
|
||||
{
|
||||
PanelOrderOut.Hidden = false;
|
||||
Grid1.Title = "出库单列表";
|
||||
}
|
||||
|
||||
if (invoiceModel.CreateUser == PersonId) //创建人
|
||||
{
|
||||
// TbCreate.Hidden = false;
|
||||
if (invoiceModel.State > PhtglInvoiceService.StateCreate)
|
||||
{
|
||||
Form_approve.Hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHTGL_ApproveService.IsApprovingMan(InvoiceId, PersonId)) //判断当前人是否审批人
|
||||
{
|
||||
TbApprove.Hidden = false;
|
||||
Form_approve.Hidden = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BindApproveData()
|
||||
{
|
||||
var approveModel = PHTGL_ApproveService.GetAllApproveData(InvoiceId, Type == "0" ? "Invoice_Input" : "Invoice_Output");
|
||||
if (approveModel != null)
|
||||
{
|
||||
Grid2.DataSource = approveModel;
|
||||
Grid2.DataBind();
|
||||
}
|
||||
}
|
||||
public void BindGrid()
|
||||
{
|
||||
var invoiceDetail = PhtglInvoicedetailService.GetPHTGL_InvoiceDetailByInvoiceId(InvoiceId);
|
||||
Grid1.DataSource = invoiceDetail;
|
||||
Grid1.DataBind();
|
||||
txtSumUnitPrice.Text = invoiceDetail.Sum(p => p.UnitPrice).ToString();
|
||||
txtSumTax.Text = invoiceDetail.Sum(p => p.Tax).ToString();
|
||||
txtSumAmount.Text = invoiceDetail.Sum(p => p.Amount).ToString();
|
||||
txtAmountInWords.Text = Funs.NumericCapitalization(invoiceDetail.Sum(p => p.Amount) ?? 0);
|
||||
}
|
||||
|
||||
|
||||
protected void Grid1_OnRowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
if (e.CommandName == "delete")
|
||||
{
|
||||
PhtglInvoicedetailService.DeletePHTGL_InvoiceDetailById(e.RowID);
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
if (Type == "1")
|
||||
{
|
||||
Grid1.FindColumn("btnDelete").Hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected string GetTaxRate(object eval)
|
||||
{
|
||||
string result = "";
|
||||
if (eval != null)
|
||||
{
|
||||
decimal taxRate = Convert.ToDecimal(eval);
|
||||
string percentage = string.Format("{0:P0}", taxRate);
|
||||
result = percentage.Replace("%", "");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected string GetNoTaxPrice(object amount, object tax)
|
||||
{
|
||||
//获取amount-tax 的值
|
||||
string result = "";
|
||||
if (amount != null && tax != null)
|
||||
{
|
||||
decimal amountValue = Convert.ToDecimal(amount);
|
||||
decimal taxValue = Convert.ToDecimal(tax);
|
||||
decimal noTaxPrice = amountValue - taxValue;
|
||||
result = noTaxPrice.ToString();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var invoiceModel = BLL.PhtglInvoiceService.GetPHTGL_InvoiceById(InvoiceId);
|
||||
invoiceModel.OrderInDate = txtOrderInDate.SelectedDate;
|
||||
invoiceModel.OrderOutDate = txtOrderOutDate.SelectedDate;
|
||||
invoiceModel.OrderCode = txtOrderCode.Text;
|
||||
invoiceModel.MaterialRequisitionUnit = txtMaterialRequisitionUnit.Text;
|
||||
BLL.PhtglInvoiceService.UpdatePHTGL_Invoice(invoiceModel);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
protected void btnEditProcess_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Type == "0")
|
||||
{
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InvoiceOrderReviewEdit.aspx?InvoiceId={0}&&Type={1}", InvoiceId, "0", "编辑 - ")));
|
||||
}
|
||||
else if (Type == "1")
|
||||
{
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InvoiceOrderReviewEdit.aspx?InvoiceId={0}&&Type={1}", InvoiceId, "1", "编辑 - ")));
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnAgree_Click(object sender, EventArgs e)
|
||||
{
|
||||
PhtglInvoiceService.Approve(InvoiceId, int.Parse(Type), PersonId, true, txtApproveIdea.Text);
|
||||
ShowNotify("审批成功!", MessageBoxIcon.Success);
|
||||
if (!string.IsNullOrEmpty(Request.Params["PHTUrl"]))
|
||||
{
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
PageContext.RegisterStartupScript("closeActiveTab();");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void btnDisgree_Click(object sender, EventArgs e)
|
||||
{
|
||||
PhtglInvoiceService.Approve(InvoiceId, int.Parse(Type), PersonId, false, txtApproveIdea.Text);
|
||||
ShowNotify("审批成功!", MessageBoxIcon.Success);
|
||||
if (!string.IsNullOrEmpty(Request.Params["PHTUrl"]))
|
||||
{
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
PageContext.RegisterStartupScript("closeActiveTab();");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user