using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Web.Mvc ;
using DSWeb.TruckMng.Comm.Cookie ;
using DSWeb.TruckMng.Helper ;
using DSWeb.TruckMng.Helper.Repository ;
using HcUtility.Comm ;
using DSWeb.MvcShipping.DAL.Chfee_AuditDAL ;
using DSWeb.MvcShipping.Models.MsChFee ;
using DSWeb.Areas.Account.Models.MsOpBill ;
using DSWeb.MvcShipping.DAL.MsSysParamSet ;
using DSWeb.MvcContainer.Models.MsOpCtnBsCard ;
using DSWeb.MvcContainer.DAL.MsOpCtnBsCard ;
using DSWeb.Areas.MvcShipping.DAL ;
using DSWeb.EntityDA ;
using System.Data ;
using DSWeb.Areas.CommMng.Models ;
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL ;
using DSWeb.MvcShipping.DAL.MsChFeeDAL ;
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL ;
using DSWeb.MvcShipping.DAL.MsInfoClient ;
using DSWeb.MvcShipping.Models.MsInfoClient ;
using DSWeb.Account.Models.MsOpAuditDetail ;
using DSWeb.MvcShipping.DAL.MsCodeFeeSetList ;
namespace DSWeb.Areas.Account.Controllers
{
[JsonRequestBehavior]
public class Chfee_AuditController : Controller
{
public ActionResult Index ( )
{
return View ( ) ;
}
public ActionResult PiLiangSubmit ( )
{
return View ( ) ;
}
public ActionResult LRIndex ( )
{
return View ( ) ;
}
public ActionResult TruckIndex ( )
{
return View ( ) ;
}
public ActionResult BLIndex ( )
{
return View ( ) ;
}
public ContentResult GetDataList ( string bsno , int type , string optype , string isAll , string condition = "" , string worktype = "" )
{
var dataList = Chfee_AuditDAL . GetDataList ( bsno , type , optype , isAll , condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , worktype ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBLListData ( int start , int limit , string sort , string condition )
{
var dataList = Chfee_AuditDAL . GetBillDataList ( start , limit , condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
int count = Chfee_AuditDAL . getTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
// var list = dataList.Skip(start).Take(limit);
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBLListDataStr ( string sort , string condition )
{
var dataListStr = Chfee_AuditDAL . GetBillDataListStr ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
// int count = Chfee_AuditDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , data = dataListStr } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBLListData2 ( int start , int limit , string sort , string condition )
{
var dataList = Chfee_AuditDAL . GetBillDataList ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
// int count = Chfee_AuditDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBLListData3 ( int start , int limit , string sort , string condition )
{
var dataList = Chfee_AuditDAL . GetBillDataList3 ( start , limit , condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
//int count = Chfee_AuditDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetTruckBLListData ( int start , int limit , string sort , string condition )
{
var dataList = Chfee_AuditDAL . GetTruckBillDataList ( start , limit , condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
int count = Chfee_AuditDAL . getTruckTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
// var list = dataList.Skip(start).Take(limit);
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBLData ( string condition )
{
MsOpBill head = null ;
var list = Chfee_AuditDAL . GetBillDataList ( 0 , 2 , condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( list . Count > 0 )
head = list [ 0 ] ;
if ( head = = null )
{
head = new MsOpBill ( ) ;
}
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = head } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult Audit ( String optype , String bill , string mblno = "" , string bsno = "" , string isamend = "" , string worktype = "" )
{
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" & & isamend = = "1" ) workflowstr = "AmendFeefyAudit" ;
DBResult result = Chfee_AuditDAL . Audit ( optype , Convert . ToString ( Session [ "USERID" ] ) , bill , mblno , bsno , workflowstr ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditList ( String optype , string bill , string mblno = "" , string bsno = "" , string isamend = "" , string worktype = "" )
{
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" & & isamend = = "1" ) workflowstr = "AmendFeefyAudit" ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( bill ) ;
DBResult result = Chfee_AuditDAL . AuditList ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , mblno , bsno , workflowstr , worktype ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditBack ( String optype , String bill , string reasean , string isamend , string worktype = "" )
{
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" & & isamend = = "1" ) workflowstr = "AmendFeefyAudit" ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( bill ) ;
DBResult result = Chfee_AuditDAL . AuditBack ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , reasean , workflowstr , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAudit ( string GidStr , string optype , string bsno = "" )
{
DBResult result = Chfee_AuditDAL . SubmitAudit ( optype , Convert . ToString ( Session [ "USERID" ] ) , GidStr , bsno , "" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditAmend ( string GidStr , string optype , string bsno = "" )
{
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
DBResult result = Chfee_AuditDAL . SubmitAudit ( optype , Convert . ToString ( Session [ "USERID" ] ) , GidStr , bsno , workflowstr , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditYj ( string GidStr , string optype , string bsno = "" )
{
DBResult result = Chfee_AuditDAL . SubmitAudit ( optype , Convert . ToString ( Session [ "USERID" ] ) , GidStr , bsno , "YjFeefyAudit" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditNew ( string feebody , string optype , string bsno = "" )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
var MsFeeCurrList = new List < MsFeeCurr > ( ) ;
MsFeeCurrList = MsChFeeDAL . GetFeeDateCurrList ( "" , bsno , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var error = "" ;
if ( billData ! = null & & bsno ! = "" )
{
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
var custstr = "" ;
foreach ( var enumValue in billData )
{
if ( optype . ToLower ( ) = = "op_seae" )
{
var MsOpSeae = MsOpSeaeDAL . GetData ( "BSNO='" + bsno + "'" ) ;
error = error + MsOpSeaeDAL . IsSubmitOpSeae ( MsOpSeae ) ;
}
var BLCOUNT2 = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue . CustomerName + "' and CORPID='" + Convert . ToString ( Session [ "COMPANYID" ] ) + "'" ) ;
if ( BLCOUNT2 = = "0" )
{
if ( custstr = = "" ) custstr = enumValue . CustomerName ;
else custstr = custstr + "," + enumValue . CustomerName ;
}
if ( enumValue . Currency ! = "RMB" )
{
var MsFeeCurr = MsFeeCurrList . Find ( x = > x . CURR = = enumValue . Currency ) ;
if ( MsFeeCurr ! = null )
{
if ( enumValue . ExChangerate ! = MsFeeCurr . DEFRATE ) {
error = error + "<br />[" + enumValue . FeeName + "]费用汇率与设置汇率不一致" ;
}
//if (enumValue.FeeType == 1)
//enumValue.ExChangerate = MsFeeCurr.DEFRATE;
//else
//{
// if (MsFeeCurr.CRDEFRATE != 0) enumValue.ExChangerate = MsFeeCurr.CRDEFRATE;
// else enumValue.ExChangerate = MsFeeCurr.DEFRATE;
//}
}
}
if ( enumValue . UnitPrice = = 0 )
{
error = error + "<br />[" + enumValue . FeeName + "]费用单价不能为0" ;
}
if ( enumValue . Quantity = = 0 )
{
error = error + "<br />[" + enumValue . FeeName + "]费用数量不能为0" ;
}
if ( enumValue . ExChangerate = = 0 )
{
error = error + "<br />[" + enumValue . FeeName + "]费用汇率不能为0" ;
}
if ( enumValue . Amount = = 0 )
{
error = error + "<br />[" + enumValue . FeeName + "]费用金额不能等于0" ;
}
if ( string . IsNullOrEmpty ( enumValue . CustomerName ) )
{
error = error + "<br />[" + enumValue . FeeName + "]费用客户名称不能为空" ;
}
if ( string . IsNullOrEmpty ( enumValue . FeeName ) )
{
error = error + "<br />费用名称不能为空" ;
}
if ( string . IsNullOrEmpty ( enumValue . Unit ) )
{
error = error + "<br />[" + enumValue . FeeName + "]费用单位标准不能为空" ;
}
}
if ( ! string . IsNullOrEmpty ( error ) )
{
DBResult result3 = new DBResult ( ) ;
result3 . Success = false ;
result3 . Message = error ;
var json3 = JsonConvert . Serialize ( result3 ) ;
return new ContentResult ( ) { Content = json3 } ;
}
if ( custstr ! = "" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "客户名称:" + custstr + " ,系统中不存在,请检查!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + bsno + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var type = billData [ 0 ] . FeeType ;
BLCOUNT = "" ;
if ( type = = 1 )
BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from op_close WHERE DRCLOSE=1 AND BSNO='" + bsno + "'" ) ;
else BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from op_close WHERE CRCLOSE=1 AND BSNO='" + bsno + "'" ) ;
if ( BLCOUNT = = "1" )
{
if ( type = = 1 )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "应收费用已锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "应付费用已锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
var iResult = MsChFeeDAL . SaveUpdateFee ( billData , bsno , CookieConfig . GetCookie_UserId ( Request ) ) ;
}
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , false , "" , ISSALEWORK , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditOp ( string feebody , string optype , string bsno = "" )
{
var workflowstr = "OpFeeAudit" ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
if ( billData ! = null & & bsno ! = "" )
{
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
var custstr = "" ;
foreach ( var enumValue in billData )
{
var BLCOUNT2 = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue . CustomerName + "' and CORPID='" + Convert . ToString ( Session [ "COMPANYID" ] ) + "'" ) ;
if ( BLCOUNT2 = = "0" )
{
if ( custstr = = "" ) custstr = enumValue . CustomerName ;
else custstr = custstr + "," + enumValue . CustomerName ;
}
}
if ( custstr ! = "" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "客户名称:" + custstr + " ,系统中不存在,请检查!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + bsno + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var type = billData [ 0 ] . FeeType ;
BLCOUNT = "" ;
if ( type = = 1 )
BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from op_close WHERE DRCLOSE=1 AND BSNO='" + bsno + "'" ) ;
else BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from op_close WHERE CRCLOSE=1 AND BSNO='" + bsno + "'" ) ;
if ( BLCOUNT = = "1" )
{
if ( type = = 1 )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "应收费用已锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "应付费用已锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
var iResult = MsChFeeDAL . SaveUpdateFee ( billData , bsno , CookieConfig . GetCookie_UserId ( Request ) ) ;
}
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , false , workflowstr , "0" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditNewAmend ( string feebody , string optype , string bsno = "" )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
if ( billData ! = null & & bsno ! = "" )
{
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
var custstr = "" ;
foreach ( var enumValue in billData )
{
var BLCOUNT2 = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue . CustomerName + "' and CORPID='" + Convert . ToString ( Session [ "COMPANYID" ] ) + "'" ) ;
if ( BLCOUNT2 = = "0" )
{
if ( custstr = = "" ) custstr = enumValue . CustomerName ;
else custstr = custstr + "," + enumValue . CustomerName ;
}
}
if ( custstr ! = "" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "客户名称:" + custstr + " ,系统中不存在,请检查!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + bsno + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var type = billData [ 0 ] . FeeType ;
BLCOUNT = "" ;
if ( type = = 1 )
BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from op_close WHERE DRCLOSE=1 AND BSNO='" + bsno + "'" ) ;
else BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from op_close WHERE CRCLOSE=1 AND BSNO='" + bsno + "'" ) ;
if ( BLCOUNT = = "1" )
{
if ( type = = 1 )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "应收费用已锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "应付费用已锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
var iResult = MsChFeeDAL . SaveUpdateFee ( billData , bsno , CookieConfig . GetCookie_UserId ( Request ) ) ;
}
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , false , workflowstr , ISSALEWORK , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditOpAmend ( string feebody , string optype )
{
var workflowstr = "OpFeeAudit" ;
//var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
//if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , false , workflowstr , "0" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditNewYj ( string feebody , string optype )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , false , "YjFeefyAudit" , ISSALEWORK , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult IsSubmitAuditBL ( string optype , string bsno = "" , string pbsno = "" )
{
#region
string mblnotemp = "" ;
var auditlist = new List < MsOpAuditDetail > ( ) ;
var error = "" ;
var DrChfeeList = MsChFeeDAL . GetAllDataList ( "BSNO in (select BSNO FROM V_OP_BILL WHERE PARENTID='" + pbsno + "') AND FEETYPE=1 " ) ;
var CrChfeeList = MsChFeeDAL . GetAllDataList ( "BSNO in (select BSNO FROM V_OP_BILL WHERE PARENTID='" + pbsno + "') AND FEETYPE=2 " ) ;
if ( DrChfeeList ! = null & & DrChfeeList . Count ! = 0 ) {
foreach ( var fee in DrChfeeList ) {
if ( fee . UnitPrice = = 0 ) {
error = error + "<br />应收费用[" + fee . FeeName + "]单价不能为0" ;
}
if ( fee . Quantity = = 0 )
{
error = error + "<br />应收费用[" + fee . FeeName + "]数量不能为0" ;
}
if ( fee . ExChangerate = = 0 )
{
error = error + "<br />应收费用[" + fee . FeeName + "]汇率不能为0" ;
}
if ( fee . Amount = = 0 )
{
error = error + "<br />结算单位;" + fee . CustomerName + " 费用名称:" + fee . FeeName + " 应收费用金额不能等于0" ;
}
if ( string . IsNullOrEmpty ( fee . CustomerName ) )
{
error = error + "<br />应收费用[" + fee . FeeName + "]客户名称不能为空" ;
}
if ( string . IsNullOrEmpty ( fee . FeeName ) )
{
error = error + "<br />应收费用名称不能为空" ;
}
if ( string . IsNullOrEmpty ( fee . Unit ) )
{
error = error + "<br />应收费用[" + fee . FeeName + "]单位标准不能为空" ;
}
}
}
if ( CrChfeeList ! = null & & CrChfeeList . Count ! = 0 )
{
foreach ( var fee in CrChfeeList )
{
if ( fee . UnitPrice = = 0 )
{
error = error + "<br />应付费用[" + fee . FeeName + "]单价不能为0" ;
}
if ( fee . Quantity = = 0 )
{
error = error + "<br />应付费用[" + fee . FeeName + "]数量不能为0" ;
}
if ( fee . ExChangerate = = 0 )
{
error = error + "<br />应付费用[" + fee . FeeName + "]汇率不能为0" ;
}
if ( fee . Amount = = 0 )
{
error = error + "<br />结算单位;" + fee . CustomerName + " 费用名称:" + fee . FeeName + " 应付费用金额不能等于0" ;
}
if ( string . IsNullOrEmpty ( fee . CustomerName ) )
{
error = error + "<br />应付费用[" + fee . FeeName + "]客户名称不能为空" ;
}
if ( string . IsNullOrEmpty ( fee . FeeName ) )
{
error = error + "<br />应付费用名称不能为空" ;
}
if ( string . IsNullOrEmpty ( fee . Unit ) )
{
error = error + "<br />应付费用[" + fee . FeeName + "]单位标准不能为空" ;
}
}
}
if ( ! string . IsNullOrEmpty ( error ) )
{
DBResult result3 = new DBResult ( ) ;
result3 . Success = false ;
result3 . Message = error ;
var json3 = JsonConvert . Serialize ( result3 ) ;
return new ContentResult ( ) { Content = json3 } ;
}
var feecodelist = MsCodeFeeSetListDAL . GetDataList ( "" , 0 , 10000 ) ;
optype = optype . ToLower ( ) ;
var customername = "" ;
var carrier = "" ;
var pscust = "" ;
var saledept = "" ;
var warningstr = "" ;
var ismblfrt = false ;
var psclientlist = new List < MsClient > ( ) ;
var _dmb = new STLDATEmb ( ) ;
//var clientps = new List<ClientPS>();
if ( optype = = "op_seae" )
{
var MsOpSeae = MsOpSeaeDAL . GetData ( "BSNO='" + pbsno + "'" ) ;
error = MsOpSeaeDAL . IsSubmitOpSeae ( MsOpSeae ) ;
customername = MsOpSeae . CUSTOMERNAME ;
carrier = MsOpSeae . CARRIER ;
saledept = MsOpSeae . SALEDEPT ;
psclientlist = MsInfoClientDAL . GetDataListAll ( "PSCUST IN ('" + MsOpSeae . CUSTOMERNAME + "','" + MsOpSeae . CARRIER + "')" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
_dmb = MsInfoClientDAL . GetSTLDATE ( MsOpSeae . CUSTOMERNAME , "海运出口" , MsOpSeae . ETD , MsOpSeae . SALE , MsOpSeae . CARRIER , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( MsOpSeae . BLFRT . IndexOf ( "PREPAID" ) > 0 ) ismblfrt = true ;
}
if ( optype = = "op_seai" )
{
}
if ( optype = = "op_aire" )
{
}
if ( optype = = "op_airi" )
{
}
if ( optype = = "op_apply" )
{
}
if ( optype = = "op_bulk" )
{
}
if ( optype = = "op_other" | | optype = = "tmswlpchead" | | optype = = "opctnbscard" | | optype = = "import_main" )
{
}
if ( optype = = "op_railway" )
{
}
if ( optype . ToLower ( ) = = "wms" | | optype . ToLower ( ) = = "wms_in" | | optype . ToLower ( ) = = "wms_out" )
{
}
var cust = MsInfoClientDAL . GetData ( "SHORTNAME='" + customername + "'" ) ;
var crfeesum = new List < MsChFee > ( ) ;
var drfeesum = new List < MsChFee > ( ) ;
var feeCurrlist = MsChFeeDAL . GetFeeDateCurrList ( optype , bsno , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var isps = false ;
var iscarrierhyf = false ;
var ishps = false ;
var sort = 0 ;
int line = 0 ;
foreach ( var crfee in CrChfeeList )
{
line = line + 1 ;
if ( feeCurrlist . Find ( x = > x . CURR = = crfee . Currency & & crfee . ExChangerate ! = x . CRDEFRATE ) ! = null )
{
error = error + "<br />应付汇率与设置汇率不一致" ;
}
if ( crfee . FeeName = = "P/S" | | crfee . FeeName = = "HP/S" )
{
if ( crfee . CustomerName ! = customername & & crfee . CustomerName ! = carrier )
{
var pscu = psclientlist . Find ( x = > x . SHORTNAME = = crfee . CustomerName ) ;
if ( pscu = = null )
{
error = error + "<br /> " + crfee . FeeName + " 对应结算单位不相符,请检查应付第" + line . ToString ( ) + "行" ;
}
}
if ( crfee . Currency = = "RMB" & & crfee . FeeName = = "P/S" )
{
error = error + "<br />PS费, 不允许RMB币别! " ;
}
if ( crfee . FeeName = = "HP/S" ) ishps = true ;
if ( crfee . FeeName = = "P/S" )
{
isps = true ;
pscust = crfee . CustomerName ;
}
}
var feecode = feecodelist . Find ( x = > x . NAME = = crfee . FeeName ) ;
if ( feecode ! = null & & ! feecode . ISNOTPR )
{
var feesum = crfeesum . Find ( x = > x . FeeName = = crfee . FeeName ) ;
if ( feesum = = null )
{
var tmpfeesum = new MsChFee ( ) ;
tmpfeesum . FeeName = crfee . FeeName ;
tmpfeesum . Currency = crfee . Currency ;
tmpfeesum . Amount = crfee . Amount ;
tmpfeesum . ExChangerate = crfee . ExChangerate ;
tmpfeesum . PreAmountttl = crfee . Amount * crfee . ExChangerate ;
crfeesum . Add ( tmpfeesum ) ;
}
else
{
feesum . Amount = feesum . Amount + crfee . Amount ;
feesum . PreAmountttl = feesum . PreAmountttl + crfee . Amount * crfee . ExChangerate ;
}
}
if ( crfee . FeeName = = "海运费" & & crfee . CustomerName = = carrier )
{
iscarrierhyf = true ;
}
}
foreach ( var crfee in DrChfeeList )
{
if ( feeCurrlist . Find ( x = > x . CURR = = crfee . Currency & & crfee . ExChangerate ! = x . CRDEFRATE ) ! = null )
{
error = error + "<br />应收汇率与设置汇率不一致" ;
}
var feesum = drfeesum . Find ( x = > x . FeeName = = crfee . FeeName ) ;
if ( feesum = = null )
{
var tmpfeesum = new MsChFee ( ) ;
tmpfeesum . FeeName = crfee . FeeName ;
tmpfeesum . Currency = crfee . Currency ;
tmpfeesum . Amount = crfee . Amount ;
tmpfeesum . ExChangerate = crfee . ExChangerate ;
tmpfeesum . PreAmountttl = crfee . Amount * crfee . ExChangerate ;
drfeesum . Add ( tmpfeesum ) ;
}
else
{
feesum . Amount = feesum . Amount + crfee . Amount ;
feesum . PreAmountttl = feesum . PreAmountttl + crfee . Amount * crfee . ExChangerate ;
}
}
decimal psbl = 0 ;
if ( ! string . IsNullOrEmpty ( pscust ) )
{
//var clientpslist = MsInfoClientDAL.GetPSDataList("CUSTNAME='" + pscust + "'");
//if (clientpslist.Count == 1) { psbl = clientpslist[0].PS; }
//else
//{
// foreach (var clientps in clientpslist)
// {
// if (!string.IsNullOrEmpty(clientps.SALEDEPT) && clientps.SALEDEPT == saledept)
// {
// psbl = clientps.PS;
// break;
// }
// }
// if (clientpslist.Count > 1 && psbl == 0) psbl = clientpslist[0].PS;
//}
}
var feettlsum = MsChFeeDAL . GetttlGainList ( "BSNO='" + pbsno + "'" ) ;
if ( isps & & ( feettlsum . TTLHYFDR - feettlsum . TTLHYFCR ) < = 0 ) {
error = error + "<br />海运费利润为0不允许做PS费" ;
}
if ( isps & & psbl = = 0 ) {
var clientpslist = MsInfoClientDAL . GetPSDataList ( "LINKGID in (select GID from info_client where shortname='" + customername + "')" ) ;
if ( clientpslist . Count = = 1 ) { psbl = clientpslist [ 0 ] . PS ; }
else
{
foreach ( var clientps in clientpslist )
{
if ( ! string . IsNullOrEmpty ( clientps . SALEDEPT ) & & clientps . SALEDEPT = = saledept )
{
psbl = clientps . PS ;
break ;
}
}
if ( clientpslist . Count > 1 & & psbl = = 0 ) psbl = clientpslist [ 0 ] . PS ;
}
//var clientpslist = MsInfoClientDAL.GetPSDataList("CUSTNAME in (select PSCUST from info_client where shortname='" + pscust + "')");
//if (clientpslist.Count == 1) { psbl = clientpslist[0].PS; }
//else
//{
// foreach (var clientps in clientpslist)
// {
// if (!string.IsNullOrEmpty(clientps.SALEDEPT) && clientps.SALEDEPT == saledept)
// {
// psbl = clientps.PS;
// break;
// }
// }
// if (clientpslist.Count > 1 && psbl == 0) psbl = clientpslist[0].PS;
//}
}
if ( isps & & psbl = = 0 )
{
//var clientpslist = MsInfoClientDAL.GetPSDataList("CUSTNAME='"+customername+"'");
//if (clientpslist.Count == 1) { psbl = clientpslist[0].PS; }
//else
//{
// foreach (var clientps in clientpslist)
// {
// if (!string.IsNullOrEmpty(clientps.SALEDEPT) && clientps.SALEDEPT == saledept)
// {
// psbl = clientps.PS;
// break;
// }
// }
// if (clientpslist.Count > 1 && psbl == 0) psbl = clientpslist[0].PS;
//}
}
if ( isps & & psbl = = 0 )
{
//var clientpslist = MsInfoClientDAL.GetPSDataList("CUSTNAME in (select PSCUST from info_client where shortname='" + customername + "')");
//if (clientpslist.Count == 1) { psbl = clientpslist[0].PS; }
//else
//{
// foreach (var clientps in clientpslist)
// {
// if (!string.IsNullOrEmpty(clientps.SALEDEPT) && clientps.SALEDEPT == saledept)
// {
// psbl = clientps.PS;
// break;
// }
// }
// if (clientpslist.Count > 1 && psbl == 0) psbl = clientpslist[0].PS;
//}
}
var isfindhyf = false ;
foreach ( var crfee in crfeesum )
{
var feesum = drfeesum . Find ( x = > x . FeeName = = crfee . FeeName ) ;
if ( feesum ! = null )
{
if ( ! cust . ISNOTPR )
{
if ( feesum . PreAmountttl < crfee . PreAmountttl )
{
error = error + "<br />费用名称【" + crfee . FeeName + "】应收小于应付" ;
}
}
//if (feesum.FeeName == "海运费")
//{
// if (isps && feesum.PreAmountttl > crfee.PreAmountttl)
// {
// isfindhyf = true;
// }
//}
}
else
{
if ( ! cust . ISNOTPR )
{
error = error + "<br />费用名称【" + crfee . FeeName + "】应收小于应付" ;
}
}
}
//if (isps && !isfindhyf)
//{
// error = error + "<br />海运费USD利润是0, 存在PS";
//}
if ( ! string . IsNullOrEmpty ( error ) )
{
DBResult result2 = new DBResult ( ) ;
result2 . Success = false ;
result2 . Message = error ;
var json2 = JsonConvert . Serialize ( result2 ) ;
return new ContentResult ( ) { Content = json2 } ;
}
if ( ismblfrt & & ! iscarrierhyf )
{
sort = sort + 1 ;
var audit = new MsOpAuditDetail ( ) ;
audit . SORT = sort ;
audit . AUDITDETAILID = "SEA001" ;
audit . AUDITTYPE = "0" ;
audit . ERRMSG = "主单付费方式是预付,但不存在付船公司海运费!" ;
audit . ERRDATA = "" ;
auditlist . Add ( audit ) ;
}
if ( ishps )
{
sort = sort + 1 ;
var audit = new MsOpAuditDetail ( ) ;
audit . SORT = sort ;
audit . AUDITDETAILID = "SEA002" ;
audit . AUDITTYPE = "0" ;
audit . ERRMSG = "存在高收退费!" ;
audit . ERRDATA = "" ;
auditlist . Add ( audit ) ;
}
var profitstatus = "正常" ;
if ( feettlsum . TTLDR ! = 0 )
{
if ( ( ( feettlsum . TTLDR - feettlsum . TTLCR ) / feettlsum . TTLDR ) > 0.4 M ) profitstatus = "利润过高" ;
if ( ( ( feettlsum . TTLDR - feettlsum . TTLCR ) / feettlsum . TTLDR ) < 0.02 M ) profitstatus = "利润过低" ;
if ( ( feettlsum . TTLDR - feettlsum . TTLCR ) < 0 M ) profitstatus = "利润为负" ;
if ( ( feettlsum . TTLDR - feettlsum . TTLCR ) = = 0 M ) profitstatus = "利润为零" ;
//if (profitstatus != "正常")
//{
// var audit = new MsOpAuditDetail();
// audit.SORT = sort;
// audit.AUDITDETAILID = "SEA005";
// audit.AUDITTYPE = "0";
// audit.ERRMSG = profitstatus;
// audit.ERRDATA = "";
// auditlist.Add(audit);
//}
}
if ( isps )
{
if ( Math . Round ( ( feettlsum . TTLCR - feettlsum . NOPSTTLCR ) / ( feettlsum . TTLHYFDR - feettlsum . TTLHYFCR ) , 2 , MidpointRounding . AwayFromZero ) ! = psbl )
{
if ( profitstatus = = "正常" )
{
if ( Math . Round ( ( feettlsum . TTLCR - feettlsum . NOPSTTLCR ) / ( feettlsum . TTLHYFDR - feettlsum . TTLHYFCR ) , 2 , MidpointRounding . AwayFromZero ) ! = psbl )
{
profitstatus = "不成比例" ;
sort = sort + 1 ;
var audit = new MsOpAuditDetail ( ) ;
audit . SORT = sort ;
audit . AUDITDETAILID = "SEA003" ;
audit . AUDITTYPE = "0" ;
audit . ERRMSG = "PS不成比例, 公司实际分成比例" + Math . Round ( 1 - ( feettlsum . TTLCR - feettlsum . NOPSTTLCR ) / ( feettlsum . TTLHYFDR - feettlsum . TTLHYFCR ) , 2 , MidpointRounding . AwayFromZero ) + "(" + Math . Round ( ( 1 - psbl ) , 2 , MidpointRounding . AwayFromZero ) + ")" ;
audit . ERRDATA = "" ;
auditlist . Add ( audit ) ;
}
}
else
{
sort = sort + 1 ;
var audit = new MsOpAuditDetail ( ) ;
audit . SORT = sort ;
audit . AUDITDETAILID = "SEA006" ;
audit . AUDITTYPE = "0" ;
audit . ERRMSG = profitstatus + ",PS不成比例, 公司实际分成比例" + Math . Round ( 1 - ( feettlsum . TTLCR - feettlsum . NOPSTTLCR ) / ( feettlsum . TTLHYFDR - feettlsum . TTLHYFCR ) , 2 , MidpointRounding . AwayFromZero ) + "(" + Math . Round ( ( 1 - psbl ) , 2 , MidpointRounding . AwayFromZero ) + ")" ;
audit . ERRDATA = "" ;
auditlist . Add ( audit ) ;
if ( profitstatus ! = "利润过高" )
profitstatus = "不成比例且过低" ;
}
}
}
else {
if ( profitstatus ! = "正常" )
{
var audit = new MsOpAuditDetail ( ) ;
audit . SORT = sort ;
audit . AUDITDETAILID = "SEA005" ;
audit . AUDITTYPE = "0" ;
audit . ERRMSG = profitstatus ;
audit . ERRDATA = "" ;
auditlist . Add ( audit ) ;
}
}
if ( _dmb . ALLOWAMOUNT ! = 0 )
{
if ( feettlsum . TTLDR > _dmb . ALLOWAMOUNT )
{
sort = sort + 1 ;
var audit = new MsOpAuditDetail ( ) ;
audit . SORT = sort ;
audit . AUDITDETAILID = "SEA004" ;
audit . AUDITTYPE = "0" ;
audit . ERRMSG = "单票应收费用超过系统限额RMB, 请及时收款" ;
audit . ERRDATA = "" ;
auditlist . Add ( audit ) ;
}
}
Chfee_AuditDAL . SaveUpdateAudit ( "" , bsno , Convert . ToString ( Session [ "SHOWNAME" ] ) , profitstatus , "insert" ) ;
if ( auditlist . Count ! = 0 )
{
DBResult result2 = new DBResult ( ) ;
result2 . Success = false ;
result2 . Message = "" ;
result2 . Data = auditlist . ToList ( ) ;
var json2 = JsonConvert . Serialize ( result2 ) ;
return new ContentResult ( ) { Content = json2 } ;
}
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL . GetData ( "PARAMNAME='SUBMITFEEBLFEELOCK'" ) ;
var BLAUDITISSEFT = MsSysParamSetDAL . GetData ( "PARAMNAME='BLAUDITISSEFT'" ) ;
if ( BLAUDITISSEFT . PARAMVALUE = = "1" )
{
var billlist = Chfee_AuditDAL . GetBillDataList ( "MASTERNO='" + bsno + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
foreach ( var bill in billlist )
{
if ( bill . BillFeeStatus = = "2" | | bill . BillFeeStatus = = "1" )
{
DBResult result2 = new DBResult ( ) ;
result2 . Success = false ;
result2 . Message = "当前状态无法提交整票审核!" ;
var json2 = JsonConvert . Serialize ( result2 ) ;
return new ContentResult ( ) { Content = json2 } ;
}
}
DBResult resultbl = Chfee_AuditDAL . SubmitAuditBL ( Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , billlist , true , "" , "" , Convert . ToString ( Session [ "COMPANYID" ] ) , "1" ) ;
var jsonbl = JsonConvert . Serialize ( resultbl ) ;
return new ContentResult ( ) { Content = jsonbl } ;
}
# endregion
//解决整票状态更新成功,但引无提交数据的报错
DBResult result = new DBResult ( ) ;
result . Success = true ;
result . Message = "" ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditBL ( string feebody , string optype , string bsno = "" , string shenremarks = "" )
{
var MsOpAuditDetailList = JsonConvert . Deserialize < List < MsOpAuditDetail > > ( feebody ) ;
if ( MsOpAuditDetailList . Count ! = 0 )
{
Chfee_AuditDAL . SaveUpdateAuditDetail ( MsOpAuditDetailList , bsno , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
var billlist = Chfee_AuditDAL . GetBillDataList ( "v_op_bill.BSNO='" + bsno + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
foreach ( var bill in billlist )
{
if ( bill . BillFeeStatus = = "2" | | bill . BillFeeStatus = = "1" )
{
DBResult result2 = new DBResult ( ) ;
result2 . Success = false ;
result2 . Message = "当前状态无法提交整票审核!" ;
var json2 = JsonConvert . Serialize ( result2 ) ;
return new ContentResult ( ) { Content = json2 } ;
}
}
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL . GetData ( "PARAMNAME='SUBMITFEEBLFEELOCK'" ) ;
DBResult resultbl = Chfee_AuditDAL . SubmitAuditBL ( Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , billlist , true , "" , "" , Convert . ToString ( Session [ "COMPANYID" ] ) , SUBMITFEEBLFEELOCK . PARAMVALUE ) ;
if ( resultbl . Success ) {
Chfee_AuditDAL . SaveUpdateAudit ( shenremarks , bsno , Convert . ToString ( Session [ "SHOWNAME" ] ) , "" , "insert" ) ;
Chfee_AuditDAL . GetEmailHtml ( bsno , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "DEPTNAME" ] ) , MsOpAuditDetailList ) ;
}
var jsonbl = JsonConvert . Serialize ( resultbl ) ;
return new ContentResult ( ) { Content = jsonbl } ;
}
public ContentResult SubmitAuditBLAmend ( string feebody , string optype , string bsno = "" )
{
string mblnotemp = "" ;
var SUBMITBILLFEEISNOTZERO = MsSysParamSetDAL . GetData ( "PARAMNAME='SUBMITBILLFEEISNOTZERO'" ) ;
if ( SUBMITBILLFEEISNOTZERO . PARAMVALUE = = "1" )
{
var FEEMANGERMUSTBE = MsSysParamSetDAL . GetData ( "PARAMNAME='FEEMANGERMUSTBE'" ) ;
bool checkRst = MsOpSeaeDAL . CheckHasZeroFeeWithBsno ( "'" + bsno + "'" , FEEMANGERMUSTBE . PARAMVALUE , out mblnotemp ) ;
if ( checkRst )
{
DBResult resultC = new DBResult ( ) ;
resultC . Success = false ;
if ( FEEMANGERMUSTBE . PARAMVALUE = = "1" )
resultC . Message = "存在金额为0的或责任人为空的费用, 无法整票提交" ;
else
resultC . Message = "存在金额为0或申请修改、申请删除的费用, 无法整票提交" ;
var jsonC = JsonConvert . Serialize ( resultC ) ;
return new ContentResult ( ) { Content = jsonC } ;
}
}
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL . GetData ( "PARAMNAME='SUBMITFEEBLFEELOCK'" ) ;
var BLAUDITISSEFT = MsSysParamSetDAL . GetData ( "PARAMNAME='BLAUDITISSEFT'" ) ;
if ( BLAUDITISSEFT . PARAMVALUE = = "1" )
{
var billlist = Chfee_AuditDAL . GetBillDataList ( "V_OP_BILL.BSNO='" + bsno + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
DBResult resultbl = Chfee_AuditDAL . SubmitAuditBL ( Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , billlist , true , "" , "" , Convert . ToString ( Session [ "COMPANYID" ] ) , SUBMITFEEBLFEELOCK . PARAMVALUE ) ;
var jsonbl = JsonConvert . Serialize ( resultbl ) ;
return new ContentResult ( ) { Content = jsonbl } ;
}
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , true , workflowstr , ISSALEWORK , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetAuditDetailDataList ( string condition , string sort )
{
var dataList = Chfee_AuditDAL . GetAuditDetailDataList ( condition , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelAuditBL ( string bsno )
{
var billlist = Chfee_AuditDAL . GetBillDataList ( "V_OP_BILL.BSNO='" + bsno + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
if ( billlist ! = null & & billlist . Count ! = 0 ) {
foreach ( var bill in billlist ) {
if ( bill . BillFeeStatus = = "2" ) {
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已财务审核,不允许撤销请核!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
if ( bill . SORT > 1 ) {
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已经理审核,不允许撤销请核!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
}
DBResult result = Chfee_AuditDAL . CancelAuditBL ( Convert . ToString ( Session [ "USERID" ] ) , billlist ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelAuditBLList ( string bsnos )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
var billlist = Chfee_AuditDAL . GetBillDataList ( "V_OP_BILL.BSNO in ('" + bsnos + "')" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
if ( billlist ! = null & & billlist . Count ! = 0 )
{
foreach ( var bill in billlist )
{
if ( bill . BillFeeStatus = = "2" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已财务审核,不允许撤销请核!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
if ( bill . SORT > 1 )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已经理审核,不允许撤销请核!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
}
DBResult result = Chfee_AuditDAL . CancelAuditBL ( Convert . ToString ( Session [ "USERID" ] ) , billlist ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SelAuditBL ( string data , string worktype = "" )
{
var billData = JsonConvert . Deserialize < List < MsOpBill > > ( data ) ;
var billlist = new List < MsOpBill > ( ) ;
foreach ( var items in billData )
{
if ( items . BLTYPE . IndexOf ( "主票" ) > 0 & & items . OPTYPE ! = "更改单" )
{
var fenlist = Chfee_AuditDAL . GetBillDataList ( "MASTERNO='" + items . BSNO + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
foreach ( var fen in fenlist )
{
billlist . Add ( fen ) ;
}
}
else
billlist . Add ( items ) ;
}
DBResult result = null ;
result = Chfee_AuditDAL . AuditListBL ( Convert . ToString ( Session [ "USERID" ] ) , billlist , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( result . Success )
{
foreach ( var items in billData )
{
Chfee_AuditDAL . SaveUpdateAudit ( "" , items . BSNO , Convert . ToString ( Session [ "SHOWNAME" ] ) , "" , "update" , items . SORT ) ;
}
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SelAuditBackBL ( string data , string worktype = "" , string reason = "" , string tz = "" )
{
var billData = JsonConvert . Deserialize < List < MsOpBill > > ( data ) ;
DBResult result = null ;
var billlist = new List < MsOpBill > ( ) ;
foreach ( var items in billData )
{
if ( items . BLTYPE . IndexOf ( "主票" ) > 0 & & items . OPTYPE ! = "更改单" )
{
var fenlist = Chfee_AuditDAL . GetBillDataList ( "MASTERNO='" + items . BSNO + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
foreach ( var fen in fenlist )
{
billlist . Add ( fen ) ;
}
}
else
billlist . Add ( items ) ;
}
result = Chfee_AuditDAL . AuditBackBL ( Convert . ToString ( Session [ "USERID" ] ) , billlist , reason , Convert . ToString ( Session [ "SHOWNAME" ] ) , tz ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditBLYj ( string feebody , string optype )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var billData = JsonConvert . Deserialize < List < MsChFee > > ( feebody ) ;
DBResult result = Chfee_AuditDAL . SubmitAuditNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , true , "YjFeefyAudit" , ISSALEWORK , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetErrorFeeMbl ( string bsnos , string optype , int feetype )
{
DBResult result = Chfee_AuditDAL . GetErrorFeeMbl ( optype , bsnos , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult PiliangSubmitAudit ( string bsnos , string optype , int feetype )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
DBResult result = Chfee_AuditDAL . piliangSubmitAudit ( optype , bsnos , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult PiliangSubmitAuditlist ( string bsnos1 , string bsnos2 , string bsnos3 , string bsnos4 , string bsnos5 , string optype , int feetype )
{
DBResult result = null ;
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
if ( bsnos1 ! = "" )
{
bsnos1 = " BSNO IN (" + bsnos1 + ")" ;
result = Chfee_AuditDAL . piliangSubmitAudit ( optype , bsnos1 , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , ISSALEWORK ) ;
}
if ( bsnos2 ! = "" )
{
bsnos2 = " BSNO IN (" + bsnos2 + ")" ;
result = Chfee_AuditDAL . piliangSubmitAudit ( optype , bsnos2 , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , ISSALEWORK ) ;
}
if ( bsnos3 ! = "" )
{
bsnos3 = " BSNO IN (" + bsnos3 + ")" ;
result = Chfee_AuditDAL . piliangSubmitAudit ( optype , bsnos3 , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , ISSALEWORK ) ;
}
if ( bsnos4 ! = "" )
{
bsnos4 = " BSNO IN (" + bsnos4 + ")" ;
result = Chfee_AuditDAL . piliangSubmitAudit ( optype , bsnos4 , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , ISSALEWORK ) ;
}
if ( bsnos5 ! = "" )
{
bsnos5 = " BSNO IN (" + bsnos5 + ")" ;
result = Chfee_AuditDAL . piliangSubmitAudit ( optype , bsnos5 , feetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , ISSALEWORK ) ;
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
//public ContentResult PiliangSubmitAuditlist(string bill, string optype, int feetype)
//{
// var billList = JsonConvert.Deserialize<List<MsOpBill>>(bill);
// DBResult result = Chfee_AuditDAL.piliangSubmitAuditlist(optype, billList, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
// var json = JsonConvert.Serialize(result);
// return new ContentResult() { Content = json };
//}
public ContentResult CancelAudit ( string GidStr , string optype )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var FeeGidStr = GidStr . Replace ( "," , "','" ) ;
var DrChfeeList = MsChFeeDAL . GetAllDataList ( "GID in ('" + FeeGidStr + "')" ) ;
// var billlist = Chfee_AuditDAL.GetBillDataList("V_OP_BILL.BSNO in ('" + bsnos + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
var error = "" ;
if ( DrChfeeList ! = null & & DrChfeeList . Count ! = 0 )
{
foreach ( var fee in DrChfeeList )
{
if ( fee . Settlement ! = 0 )
{
error = error + "<br />费用[" + fee . FeeName + "]已结算" ;
}
if ( fee . DEBITAMOUNT ! = 0 )
{
error = error + "<br />费用[" + fee . FeeName + "]已对帐 " ;
}
if ( fee . Invoice ! = 0 )
{
error = error + "<br />费用[" + fee . FeeName + "]已开票" ;
}
if ( fee . OrderAmount ! = 0 )
{
error = error + "<br />费用[" + fee . FeeName + "]已申请" ;
}
if ( fee . OrderInvoice ! = 0 )
{
error = error + "<br />费用[" + fee . FeeName + "]已发票申请" ;
}
}
}
if ( ! string . IsNullOrEmpty ( error ) ) {
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = error + " 无法删除帐单!"
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
//DBResult result = Chfee_AuditDAL.CancelAudit(optype, Convert.ToString(Session["DEPTGID"]), Convert.ToString(Session["USERID"]), GidStr);
DBResult result = Chfee_AuditDAL . CancelAudit ( optype , Convert . ToString ( Session [ "USERID" ] ) , GidStr , "" , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelAuditAmend ( string GidStr , string optype )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
DBResult result = Chfee_AuditDAL . CancelAudit ( optype , Convert . ToString ( Session [ "USERID" ] ) , GidStr , workflowstr , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelAuditYj ( string GidStr , string optype )
{
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
DBResult result = Chfee_AuditDAL . CancelAudit ( optype , Convert . ToString ( Session [ "USERID" ] ) , GidStr , "YjFeefyAudit" , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult ShenModify ( string data , string olddata , string optype , string isamend = "" , string isyj = "0" )
{
var NewFee = JsonConvert . Deserialize < MsChFee > ( data ) ;
var OldFee = JsonConvert . Deserialize < MsChFee > ( olddata ) ;
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
var BLCOUNT2 = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + NewFee . CustomerName + "' and CORPID='" + Convert . ToString ( Session [ "COMPANYID" ] ) + "'" ) ;
if ( BLCOUNT2 = = "0" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "客户名称:" + NewFee . CustomerName + " ,系统中不可用,请检查!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
if ( isyj = = "1" )
{
var YJMUSTBEFEECLOSE = MsSysParamSetDAL . GetData ( "PARAMNAME='YJMUSTBEFEECLOSE'" ) ;
if ( YJMUSTBEFEECLOSE . PARAMVALUE = = "1" )
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + NewFee . BsNo + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
else
{
var nowperiod = ChMonthCloseDAL . GetData ( "" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var ACCDATE = T_ALL_DA . GetStrSQL ( "ACCDATE" , "select ACCDATE from v_op_bill WHERE BSNO='" + NewFee . BsNo + "'" ) ;
if ( Convert . ToDateTime ( nowperiod + "-01" ) > Convert . ToDateTime ( ACCDATE + "-01" ) )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已月末结转,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
}
else
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + NewFee . BsNo + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
DBResult result = Chfee_AuditDAL . ShenModify ( NewFee , OldFee , Convert . ToString ( Session [ "USERID" ] ) , optype , Convert . ToString ( Session [ "COMPANYID" ] ) , workflowstr , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult ShenDelete ( string data , string optype , string isamend = "" , string isyj = "0" )
{
var OldFee = JsonConvert . Deserialize < MsChFee > ( data ) ;
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
if ( isyj = = "1" )
{
var YJMUSTBEFEECLOSE = MsSysParamSetDAL . GetData ( "PARAMNAME='YJMUSTBEFEECLOSE'" ) ;
if ( YJMUSTBEFEECLOSE . PARAMVALUE = = "1" )
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + OldFee . BsNo + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
else
{
var nowperiod = ChMonthCloseDAL . GetData ( "" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var ACCDATE = T_ALL_DA . GetStrSQL ( "ACCDATE" , "select ACCDATE from v_op_bill WHERE BSNO='" + OldFee . BsNo + "'" ) ;
if ( Convert . ToDateTime ( nowperiod + "-01" ) > Convert . ToDateTime ( ACCDATE + "-01" ) )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已月末结转,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
}
else
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + OldFee . BsNo + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
DBResult result = Chfee_AuditDAL . ShenDelete ( OldFee , Convert . ToString ( Session [ "USERID" ] ) , optype , Convert . ToString ( Session [ "COMPANYID" ] ) , workflowstr , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult ShenDeleteList ( string data , string feedata , string optype , string isamend = "" , string isyj = "0" )
{
var OldFee = JsonConvert . Deserialize < MsChFee > ( data ) ;
var FeeList = JsonConvert . Deserialize < List < MsChFee > > ( feedata ) ;
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
if ( isyj = = "1" )
{
var YJMUSTBEFEECLOSE = MsSysParamSetDAL . GetData ( "PARAMNAME='YJMUSTBEFEECLOSE'" ) ;
if ( YJMUSTBEFEECLOSE . PARAMVALUE = = "1" )
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + OldFee . BsNo + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
else
{
var nowperiod = ChMonthCloseDAL . GetData ( "" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var ACCDATE = T_ALL_DA . GetStrSQL ( "ACCDATE" , "select ACCDATE from v_op_bill WHERE BSNO='" + OldFee . BsNo + "'" ) ;
if ( Convert . ToDateTime ( nowperiod + "-01" ) > Convert . ToDateTime ( ACCDATE + "-01" ) )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已月末结转,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
}
else
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + OldFee . BsNo + "'" ) ;
if ( BLCOUNT = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "已费用锁定,不允许添加修改费用!" ,
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
DBResult result = Chfee_AuditDAL . ShenDeleteList ( OldFee , FeeList , Convert . ToString ( Session [ "USERID" ] ) , optype , Convert . ToString ( Session [ "COMPANYID" ] ) , workflowstr , ISSALEWORK ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelShen ( string Feeid , string optype , string isamend = "" , string isopen = "" )
{
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
var ISSALEWORK = CookieConfig . GetCookie_ISSALEWORK ( Request ) ;
DBResult result = Chfee_AuditDAL . CancelShen ( Feeid , optype , Convert . ToString ( Session [ "USERID" ] ) , workflowstr , ISSALEWORK , isopen ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditBackShen ( String optype , string bill , string reasean , string isamend = "" )
{
var billData = JsonConvert . Deserialize < List < MsChFee > > ( bill ) ;
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
DBResult result = Chfee_AuditDAL . AuditBackShen ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , reasean , workflowstr ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditShen ( String optype , String bill , int Feestatus , string bsno , string isamend = "" )
{
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
DBResult result = Chfee_AuditDAL . AuditShen ( optype , Convert . ToString ( Session [ "USERID" ] ) , bill , Feestatus , bsno , workflowstr ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditShenNew ( String optype , String bill , string isamend = "" )
{
var billData = JsonConvert . Deserialize < List < MsChFee > > ( bill ) ;
var workflowstr = "" ;
if ( isamend = = "1" )
{
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
}
DBResult result = Chfee_AuditDAL . AuditShenNew ( optype , Convert . ToString ( Session [ "USERID" ] ) , billData , workflowstr ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult ShenNewCustName ( String data , string CustomerName )
{
var billData = JsonConvert . Deserialize < List < MsChFee > > ( data ) ;
DBResult result = Chfee_AuditDAL . ShenNewCustName ( billData , CustomerName , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult ShenCF ( string data , string bodylist )
{
var billData = JsonConvert . Deserialize < List < FeeCF > > ( bodylist ) ;
var FeeData = JsonConvert . Deserialize < MsChFee > ( data ) ;
DBResult result = Chfee_AuditDAL . ShenCF ( FeeData , billData , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult NoIvoice ( String bill )
{
DBResult result = Chfee_AuditDAL . NoIvoice ( bill ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SetIsOpen ( string GidStr )
{
DBResult result = Chfee_AuditDAL . SetIsOpen ( GidStr , true ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult UpLock ( string bsno , string optype )
{
var AuditAutoLock = MsSysParamSetDAL . GetData ( "PARAMNAME='AuditAutoLock'" ) ;
if ( AuditAutoLock . PARAMVALUE ! = "1" )
{
var jsonRespose = new JsonResponse
{
Success = true
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
DBResult result = Chfee_AuditDAL . UpLock ( bsno , optype ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
}
public ContentResult CancelNoIvoice ( String bill )
{
DBResult result = Chfee_AuditDAL . CancelNoIvoice ( bill ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SelAudit ( string data , string worktype = "" , string feesql = "" )
{
var AuditAutoLock = MsSysParamSetDAL . GetData ( "PARAMNAME='AuditAutoLock'" ) ;
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
var billData = JsonConvert . Deserialize < List < MsOpBill > > ( data ) ;
DBResult result = null ;
foreach ( var enumValue in billData )
{
if ( enumValue . OPTYPE = = "更改单" & & AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ; else workflowstr = "" ;
result = Chfee_AuditDAL . PiliangAudit ( enumValue . OPLB , enumValue . BSNO , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , workflowstr , worktype , enumValue . MBLNO , feesql ) ;
if ( result . Success = = true )
{
if ( AuditAutoLock . PARAMVALUE = = "1" )
{
Chfee_AuditDAL . UpLock ( enumValue . BSNO , enumValue . OPLB ) ;
}
}
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SelCtnBsCardAudit ( string data )
{
var billData = JsonConvert . Deserialize < List < OpCtnBsCard > > ( data ) ;
DBResult result = null ;
foreach ( var enumValue in billData )
{
result = Chfee_AuditDAL . PiliangAudit ( "罐箱业务卡" , enumValue . GID , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , "" ) ;
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AllAudit ( string condition , string worktype = "" , string feesql = "" )
{
var AuditAutoLock = MsSysParamSetDAL . GetData ( "PARAMNAME='AuditAutoLock'" ) ;
var workflowstr = "" ;
var AMENDSELFWORK = MsSysParamSetDAL . GetData ( "PARAMNAME='AMENDSELFWORKFLOW'" ) ;
if ( AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ;
var billData = Chfee_AuditDAL . GetBillDataList ( 0 , 10000 , condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , null , true ) ;
DBResult result = null ;
foreach ( var enumValue in billData )
{
if ( enumValue . OPTYPE = = "更改单" & & AMENDSELFWORK . PARAMVALUE = = "1" ) workflowstr = "AmendFeefyAudit" ; else workflowstr = "" ;
result = Chfee_AuditDAL . PiliangAudit ( enumValue . OPLB , enumValue . BSNO , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , workflowstr , worktype , feesql ) ;
if ( result . Success = = true )
{
if ( AuditAutoLock . PARAMVALUE = = "1" )
{
Chfee_AuditDAL . UpLock ( enumValue . BSNO , enumValue . OPLB ) ;
}
}
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AllCtnBscardAudit ( string condition )
{
var billData = MsOpCtnBsCardDAL . GetDataAllList ( condition , "index" , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
DBResult result = null ;
foreach ( var enumValue in billData )
{
result = Chfee_AuditDAL . PiliangAudit ( "罐箱业务卡" , enumValue . GID , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , "" ) ;
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
#region 参照部分
# endregion
}
}