You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Invoice/InvoiceApplicationEdit.aspx.cs

106 lines
6.0 KiB
C#

3 years ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Text;
namespace DSWeb.Invoice
{
public partial class InvoiceApplicationEdit : System.Web.UI.Page
{
private string strInvoiceAppGID;//已开发票GID
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["id"] != null)
{
strInvoiceAppGID = Request.QueryString["id"].ToString();
h_invoiceappid.Value = strInvoiceAppGID;
}
if (strInvoiceAppGID != null)
{
GetInvoiceInfo(strInvoiceAppGID);
InvoiceApplicationDA invoiceApplicationDA = new InvoiceApplicationDA();
string strSql = "";
//string strSql = " SELECT BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,MBLNO,HBLNO,CUSTNO,INPUTBY,CREATETIME "
// + " FROM op_seae WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID = '" + strInvoiceAppGID + "')";
//strSql = String.Format(" SELECT BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,MBLNO,HBLNO,CUSTNO,INPUTBY,CREATETIME,'海运出口' OPLB "
// + " FROM op_seae WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='{0}' )"
// + " union all "
// + " SELECT BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,MBLNO,HBLNO,CUSTNO,INPUTBY,CREATETIME,'海运进口' OPLB "
// + " FROM op_seai WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='{0}' )"
// , strInvoiceAppGID);
//2013-02-05 修改
strSql = String.Format(" SELECT BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,MBLNO,HBLNO,CUSTNO,INPUTBY,CREATETIME,OPLBNAME "
+ " FROM VW_Settlement WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='{0}' )"
, strInvoiceAppGID);
DataTable sourceTable = new DataTable();
sourceTable = invoiceApplicationDA.GetExcuteSql(strSql).Tables[0];
StringBuilder sourceBuilder = new StringBuilder();
sourceBuilder.Append("{");
sourceBuilder.Append("opinfo:[");
for (int i = 0; i < sourceTable.Rows.Count; i++)
{
if (i == 0)
{
sourceBuilder.Append("{bsno:\"" + sourceTable.Rows[i][0].ToString() + "\",");
}
else
{
sourceBuilder.Append(",{bsno:\"" + sourceTable.Rows[i][0].ToString() + "\",");
}
sourceBuilder.Append("\"bsstatus\":\"" + sourceTable.Rows[i][1].ToString() + "\",");
sourceBuilder.Append("\"mblno\":\"" + sourceTable.Rows[i][2].ToString() + "\",");
//string strETD = "";
//if (!sourceTable.Rows[i][3].ToString().Trim().Equals(""))
//{
// strETD = DateTime.Parse(sourceTable.Rows[i][3].ToString()).ToString("yyyy-MM-dd");
//}
//sourceBuilder.Append("\"etd\":\"" + strETD + "\",");
sourceBuilder.Append("\"hblno\":\"" + sourceTable.Rows[i][3].ToString() + "\",");
sourceBuilder.Append("\"custno\":\"" + sourceTable.Rows[i][4].ToString() + "\",");
sourceBuilder.Append("\"inputby\":\"" + sourceTable.Rows[i][5].ToString() + "\",");
sourceBuilder.Append("\"ctime\":\"" + sourceTable.Rows[i][6].ToString() + "\",");
sourceBuilder.Append("\"oplb\":\"" + sourceTable.Rows[i][7].ToString() + "\"}");
}
sourceBuilder.Append("]");
sourceBuilder.Append("}");
this.h_opcache.Value = sourceBuilder.ToString();
}
}
private void GetInvoiceInfo(string tempInvoiceAppGID)
{
InvoiceApplicationEntity invoiceApplicationEntity = new InvoiceApplicationDA().GetInvoiceApplicationByGID(tempInvoiceAppGID);
if (invoiceApplicationEntity.GID != null)
{
this.txt_invoiceno.Value = invoiceApplicationEntity.InvoiceNO;
this.h_customer.Value = invoiceApplicationEntity.CustomerName;
this.txt_vesselvoyage.Value = invoiceApplicationEntity.VesselVoyage;
this.txt_applytime.Value = invoiceApplicationEntity.ApplyTime.ToString("yyyy-MM-dd hh:mm:ss");
this.txt_mblno.Value = invoiceApplicationEntity.MBLNO;
this.txt_pod.Value = invoiceApplicationEntity.POD;
this.txt_pol.Value = invoiceApplicationEntity.POL;
this.h_currency.Value = invoiceApplicationEntity.Currency;
this.txt_remark.Value = invoiceApplicationEntity.Remark;
this.txt_rmb.Value = invoiceApplicationEntity.Currency.Trim().ToUpper().Equals("RMB") ? invoiceApplicationEntity.ApplyAmount.ToString() : "";
this.txt_usd.Value = invoiceApplicationEntity.Currency.Trim().ToUpper().Equals("USD") ? invoiceApplicationEntity.ApplyAmount.ToString() : "";
}
}
}
}