using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DSWeb.Areas.Account.Models.MsOpBill; using DSWeb.MvcShipping.DAL.Chfee_AuditDAL; using System.Text; using DSWeb.Areas.Mobile.Models.Common; using DSWeb.Areas.Mobile.Models.Approval; using DSWeb.Areas.Mobile.DAL; using DSWeb.Areas.Mobile.Models.Login; namespace DSWeb.Areas.Mobile.Views.Approval { public partial class YSYF : System.Web.Mvc.ViewPage { List dataList = new List(); public string billListHTML; public PageContentModel model = new PageContentModel(); public User _User; public string _Keyword; protected void Page_Load ( object sender, EventArgs e ) { //GetBillData(); //SetupBillListHTML(); var openid = Request.Cookies["openid"] == null ? "" : Request.Cookies["openid"].Value; _Keyword = Request["search"] == null ? "" : Request["search"]; if (openid == "") { DBLog.Log("cookies-openid", "null"); //授权并跳转 //SetupHTML(openid.ToString()); SetupHTML("123"); } else { DBLog.Log("cookies-openid", Request.Cookies["openid"].Value); SetupHTML(openid.ToString()); } hdcomid.Value = _User.comid; hduid.Value = _User.uid; hdusername.Value = _User.codename; hdkeyword.Value = _Keyword; } private void SetupHTML (string openid) { _User = LoginDAL.GetUserWithOpenId(openid); StringBuilder sbMain = new StringBuilder(); string strCondition = @"EXISTS (select 1 from ch_fee left join workflow_using wu on wu.bsno=ch_fee.GID left join workflow_step st on (st.WORKFLOWID=wu.WORKFLOWID and st.GROUPID=WU.CurrentID) where v_op_bill.BSNO=ch_fee.BSNO and isnull((power(2,(ST.STEPNO)) & wu.stepno),0)>0 and st.AUDITOR='" +_User.uid + "' and (ch_fee.FEESTATUS=2 or ch_fee.FEESTATUS=3 or ch_fee.FEESTATUS=4) ) "; if (_Keyword!="") { strCondition += " AND MBLNO like '%"+_Keyword+"%'"; } string sort = ""; dataList = Chfee_AuditDAL.GetBillDataList(0, 50, strCondition, _User.uid, _User.codename, _User.comid, sort); //html if (dataList.Count > 0) { foreach (var bill in dataList) { string type = bill.OPTYPE=="更改单"?"1":"0"; //计算利润 YSYFAmountModel amout = ApprovalDAL.GetAmountAndLirun(bill.MBLNO); //更改单利润 GGDAmountModel ggd = new GGDAmountModel(); ggd.ggdsrmb = "0"; ggd.ggdsusd = "0"; ggd.ggdfrmb = "0"; ggd.ggdfusd = "0"; //更改单累加利润 GGDAmountModel ggd2 = new GGDAmountModel(); ggd2.ggdsrmb = "0"; ggd2.ggdsusd = "0"; ggd2.ggdfrmb = "0"; ggd2.ggdfusd = "0"; string lirunRmb = (float.Parse(amout.yingshourmb)-float.Parse(amout.yingfurmb)).ToString("f2"); string lirunUsd = (float.Parse(amout.yingshouusd)-float.Parse(amout.yingfuusd)).ToString("f2"); string ggdlirunRmb = "0"; string ggdlirunUsd = "0"; string ggd2lirunRmb = "0"; string ggd2lirunUsd = "0"; //更改单原因文本 string ggdyy = ""; if (type=="1") { ggdyy += "
更改原因:" + bill.REASON+"
创建时间:"+bill.CREATETIME; } //主内容 string listStr = ""; if (type=="1") { ggd = ApprovalDAL.GetGGDLirunWithMBLNO(bill.MBLNO,bill.BSNO,true); ggd2 = ApprovalDAL.GetGGDLirunWithMBLNO(bill.MBLNO, bill.BSNO, false); ggdlirunRmb = (float.Parse(ggd.ggdsrmb) - float.Parse(ggd.ggdfrmb)).ToString("f2"); ggdlirunUsd = (float.Parse(ggd.ggdsusd) - float.Parse(ggd.ggdfusd)).ToString("f2"); ggd2lirunRmb = (float.Parse(ggd2.ggdsrmb) - float.Parse(ggd2.ggdfrmb)).ToString("f2"); ggd2lirunUsd = (float.Parse(ggd2.ggdsusd) - float.Parse(ggd2.ggdfusd)).ToString("f2"); listStr = bill.MBLNO + "
[" + bill.CUSTOMERNAME + "][" + "" + bill.OPTYPE + "]" + ggdyy + "
应收 RMB:" + ggd.ggdsrmb + " USD:" + ggd.ggdsusd + "
" + "应付 RMB:" + ggd.ggdfrmb + " USD:" + ggd.ggdfusd + "
利润 RMB:" + ggdlirunRmb + " USD:" + ggdlirunUsd; } else { listStr = bill.MBLNO + "
[" + bill.CUSTOMERNAME + "][" + "" + bill.OPTYPE + "]" + ggdyy + "
应收 RMB:" + amout.yingshourmb + " USD:" + amout.yingshouusd + "
" + "应付 RMB:" + amout.yingfurmb + " USD:" + amout.yingfuusd + "
利润 RMB:" + lirunRmb + " USD:" + lirunUsd; } //更改后利润 string amoutStr = ""; if (type=="1") { string rmbstr = (float.Parse(lirunRmb) + float.Parse(ggd2lirunRmb)).ToString("f2"); string usdstr = (float.Parse(lirunUsd) + float.Parse(ggd2lirunUsd)).ToString("f2"); amoutStr = "
更改后的总利润
RMB:" + rmbstr + " USD:" + usdstr; } listStr += amoutStr; //机密费用 string jimiStr = ""; JiMiFeeModel jm = ApprovalDAL.GetJiMiFeeInfo(bill.BSNO, _User.uid); if (jm!=null) { jimiStr += "
"+jm.JimiName + " USD:" + jm.JimiUsd; } listStr += jimiStr; sbMain.Append("
  • "); sbMain.Append(""); // sbMain.Append("
    "); sbMain.Append("
    "); sbMain.Append("

    " + listStr + "


    "); //详细内容 // sbMain.Append("

    "); //sbMain.Append("

      "); //StringBuilder sbDet = new StringBuilder(); //string condition = "BILLNO = '" + cp.BILLNO + "'"; //List list = new List(); //list = ChpayapplicationDAL.GetBodyAuditList(condition); //foreach (var fee in list) //{ // //费用名称 // sbDet.Append("
    • "); // sbDet.Append(fee.FEENAME); // sbDet.Append("
    • "); // //主提单号 // sbDet.Append("
    • "); // sbDet.Append("主提单号:" + fee.MBLNO); // sbDet.Append("
    • "); // //委托单位 // sbDet.Append("
    • "); // sbDet.Append("委托单位:" + fee.CUSTOMERNAME); // sbDet.Append("
    • "); // //核销金额 // sbDet.Append("
    • "); // sbDet.Append("核销金额:" + fee.AMOUNT); // sbDet.Append("
    • "); // //原始金额 // sbDet.Append("
    • "); // sbDet.Append("原始金额:" + fee.ORIGAMOUNT); // sbDet.Append("
    • "); // //原始币别 // sbDet.Append("
    • "); // sbDet.Append("原始币别:" + fee.ORIGCURRENCY); // sbDet.Append("
    • "); // //原始汇率 // sbDet.Append("
    • "); // sbDet.Append("原始汇率:" + fee.ORIGEXCHANGERATE); // sbDet.Append("
    • "); // //开船日期 // sbDet.Append("
    • "); // sbDet.Append("开船日期:" + fee.ETD); // sbDet.Append("
    • "); //} //sbMain.Append(sbDet.ToString()); //sbMain.Append("
    "); //sbMain.Append("

    "); sbMain.Append("
    "); sbMain.Append("
  • "); } model.content = sbMain.ToString(); //页脚按钮 StringBuilder sbFooter = new StringBuilder(); if (_User.uid == null || _User.uid == string.Empty) { sbFooter.Append("
  • 返回
  • "); } else { sbFooter.Append("
  • 返回
  • "); sbFooter.Append("
  • 全选
  • "); sbFooter.Append("
  • 所选通过
  • "); sbFooter.Append("
  • 驳回
  • "); } model.footer = sbFooter.ToString(); } else { model.content = "没有待审核数据!"; model.footer = "
  • 返回
  • "; } } } }