20230223-2

临时发布20240103
ddlucky 2 years ago
parent 37ddb9ae3d
commit dd47b749ee

@ -310,7 +310,9 @@ namespace DSWeb.Areas.Account.Controllers
result= modb.Save(headData);
};
if (result.Success == true) { }
if (result.Success == true) {
ChinvoiceapplicationDAL.SetSALECORP(headData.BILLNO);
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.BILLNO);

@ -317,7 +317,7 @@ namespace DSWeb.Areas.Account.Controllers
if (result.Success == true) {
ChpayapplicationDAL.p_update_Amount(headData.BILLNO);
ChpayapplicationDAL.SetSALECORP(headData.BILLNO);
}
else
{
@ -382,7 +382,8 @@ namespace DSWeb.Areas.Account.Controllers
var CHPAYMSG = MsSysParamSetDAL.GetData("PARAMNAME='CHPAYMSG'").PARAMVALUE;
var modb = new ModelObjectDB();
var _r = ChpayapplicationDAL.SetSALECORP(bill, bodyList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var bsnoList = bodyList.Select(s => s.BSNO).Distinct().ToList();
var _r = ChpayapplicationDAL.SetSALECORP(bill, bsnoList);
if (!_r.Success)
{
return BasicDataRefDAL.GetContentResult(_r);

@ -153,9 +153,8 @@ namespace DSWeb.Areas.Account.Controllers
public ContentResult Save(string opstatus, string data)
{
var headData = JsonConvert.Deserialize<ChRecvapplication>(data);
var headData = JsonConvert.Deserialize<ChRecvapplication>(data);
if (opstatus == "add")
{
@ -181,7 +180,6 @@ namespace DSWeb.Areas.Account.Controllers
else
headData.BILLNO = PubSysDAL.GetBillNo("0307");
}
}
else if (opstatus == "edit")
{
@ -207,7 +205,10 @@ namespace DSWeb.Areas.Account.Controllers
var BILLNO = headData.BILLNO;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true) { }
if (result.Success == true) {
//保存后处理
ChrecvapplicationDAL.SetSALECORP(headData.BILLNO);
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.BILLNO);
@ -234,7 +235,7 @@ namespace DSWeb.Areas.Account.Controllers
//如果头表所属分部为空 将其设置为所选业务的销售人员所属的公司 并保存;
//如果头表所属分部不为空 判断所属分部与所选业务的销售人员所属的公司是否相同 如否则返回错误;
var bsnoList = bodyList.Select(s => s.BSNO).Distinct().ToList();
var _r = ChrecvapplicationDAL.SetSALECORP(bill, bsnoList, "", Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var _r = ChrecvapplicationDAL.SetSALECORP(bill, bsnoList);
if (!_r.Success)
{

@ -1880,9 +1880,10 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
else if (visiblerange == "2")
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
//var deptname = rangeDa.GetDEPTNAME(userid);
//str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
var deptgid = rangeDa.GetDEPTGID(userid);
str = " APPLICANT in (select USERID from vw_user where deptgid='" + deptgid + "') ";
}
else if (visiblerange == "1")
{

@ -2548,13 +2548,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoicehexiao
else if (visiblerange == "2")
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
}
//var deptname = rangeDa.GetDEPTNAME(userid);
//str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
var deptgid = rangeDa.GetDEPTGID(userid);
str = " APPLICANT in (select USERID from vw_user where deptgid='" + deptgid + "') ";
}
else if (visiblerange == "1")
{
str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')";
str = " SALECORPID='"+ companyid + "' or APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')";
}
else if (visiblerange == "0")
{
@ -2642,13 +2643,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoicehexiao
str = "";
while (reader.Read())
{
var _corpid = Convert.ToString(reader["COMPANYID"]);
if (str == "")
{
str = " (OP in (select showname from vw_user where COMPANYID='" + companyid + "') ";
str = " (OP in (select showname from vw_user where COMPANYID='" + _corpid + "') ";
}
else
{
str = str + " or OP in (select showname from vw_user where COMPANYID='" + companyid + "')";
str = str + " or OP in (select showname from vw_user where COMPANYID='" + _corpid + "')";
};
}
str = str + ")";

@ -4563,13 +4563,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
str = "";
while (reader.Read())
{
var _corpid = Convert.ToString(reader["COMPANYID"]);
if (str == "")
{
str += " (CREATEUSER='"+ userid + "' or COMPANYID='" + companyid + "' ";
str += " (CREATEUSER='"+ userid + "' or COMPANYID='" + _corpid + "' ";
}
else
{
str += " or COMPANYID='" + companyid + "' ";
str += " or COMPANYID='" + _corpid + "' ";
};
}
str = str + ")";

@ -4559,7 +4559,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
else if (visiblerange == "1")
{
str = " COMPANYID='" + companyid + "' ";
str = " COMPANYID='" + companyid + "' or SALECORPID='"+ companyid + "' ";
}
else if (visiblerange == "5")
{
@ -4572,13 +4572,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
str = "";
while (reader.Read())
{
var _corpid = Convert.ToString(reader["COMPANYID"]);
if (str == "")
{
str = " (CREATEUSER in (select USERID from user_company where COMPANYID='" + companyid + "') ";
str = $" (CREATEUSER='{userid}' or SALECORPID='" + _corpid + "' ";
}
else
{
str = str + " or CREATEUSER in (select USERID from user_company where COMPANYID='" + companyid + "')";
str = str + $" or SALECORPID='" + _corpid + "'";
};
}
str = str + ")";

@ -1688,6 +1688,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
return SetSALECORP(billno, bsnolist);
}
public static DBResult SetSALECORP(string billno)
{
var cdc = new CommonDataContext();
//var head = cdc.ch_fee_invoiceapplication.FirstOrDefault(x => x.BILLNO == billno);
var body = cdc.ch_fee_do.Where(x => x.BILLNO == billno).ToList();
var bsnoList = body.Select(s => s.BSNO).Distinct().ToList();
return SetSALECORP(billno, bsnoList);
}
public static DBResult AddDetail(string billno, List<BillChfeeDetail> bodyList, string curr, string companyid,bool isList,string GID,ChInvoiceapplication headdata)
{
var result = new DBResult();
@ -3182,9 +3190,10 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
else if (visiblerange == "2")
{
var rangeDa = new RangeDA();
var deptname = rangeDa.GetDEPTNAME(userid);
str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
//var deptname = rangeDa.GetDEPTNAME(userid);
//str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') and APPLICANT in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')";
var deptgid = rangeDa.GetDEPTGID(userid);
str = " APPLICANT in (select USERID from vw_user where deptgid='" + deptgid + "') ";
}
else if (visiblerange == "5")
{

@ -1951,11 +1951,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
/// <param name="userid"></param>
/// <param name="custgroup"></param>
/// <returns></returns>
public static DBResult SetSALECORP(string billno, List<ChFeeDetail> feelist, string companyid, string userid, bool custgroup = false)
public static DBResult SetSALECORP(string billno, List<string > bsnoList)
{
var result = new DBResult();
result.OK();
var bsnoList = feelist.Select(s => s.BSNO).Distinct().ToList();
//var bsnoList = feelist.Select(s => s.BSNO).Distinct().ToList();
var cdc = new CommonDataContext();
@ -1998,10 +1998,18 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
if (!custgroup)
feesql = feesql + " AND CUSTOMERNAME='" + billcust + "'";
var feelist = GetFeeDetailList(feesql, userid, userid, companyid);
return SetSALECORP(billno, feelist, companyid, userid, custgroup);
var bsnoList = feelist.Select(s => s.BSNO).Distinct().ToList();
return SetSALECORP(billno, bsnoList);
}
public static DBResult SetSALECORP(string billno)
{
var cdc = new CommonDataContext();
//var head = cdc.ch_fee_payapplication.FirstOrDefault(x => x.BILLNO == billno);
var body = cdc.ch_fee_do.Where(x => x.BILLNO == billno).ToList();
var bsnoList = body.Select(s => s.BSNO).Distinct().ToList();
return SetSALECORP(billno, bsnoList);
}
public static DBResult AddDetail(string billno, List<ChFeeDetail> bodyList, string curr, string companyid,string salecorp)
{
@ -3857,7 +3865,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
}
else if (visiblerange == "1")
{
str = " APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')";
str = " SALECORPID='"+ companyid + "' or APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')";
}
else if (visiblerange == "5")
{

@ -931,7 +931,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
/// <param name="userid"></param>
/// <param name="custgroup"></param>
/// <returns></returns>
public static DBResult SetSALECORP(string billno, List<string> bsnoList, string billcust, string companyid, string userid, bool custgroup = false)
public static DBResult SetSALECORP(string billno, List<string> bsnoList)
{
var result = new DBResult();
@ -986,7 +986,16 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Recvapplication
var bsnoList = feelist.Select(s => s.BSNO).Distinct().ToList();
return SetSALECORP(billno, bsnoList, billcust, companyid, userid, custgroup);
return SetSALECORP(billno, bsnoList);
}
public static DBResult SetSALECORP(string billno)
{
var cdc = new CommonDataContext();
//var head = cdc.ch_fee_recvapplication.FirstOrDefault(x => x.BILLNO == billno);
var body = cdc.ch_fee_do.Where(x => x.BILLNO == billno).ToList();
var bsnoList = body.Select(s => s.BSNO).Distinct().ToList();
return SetSALECORP(billno, bsnoList);
}
public static DBResult AddBill(string billno, string billcust, string billcurr, string feesql, List<ChFeeExrate> exratelist, string companyid,string userid, bool custgroup = false)

@ -4334,7 +4334,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Settlement
if (OPLISTNOCANCEL.PARAMVALUE == "1")
{
strSql.Append(" FROM ch_fee_recvapplication cm where BILLSTATUS IN (0,4,5) ");
} else strSql.Append(" FROM ch_fee_recvapplication cm where BILLSTATUS IN (0,2,4,5) ");
} else
strSql.Append(" FROM ch_fee_recvapplication cm where BILLSTATUS IN (0,2,4,5) ");
if (!string.IsNullOrEmpty(strCondition))
{
@ -7043,26 +7044,27 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Settlement
else if (visiblerange == "5")
{
var userstr = new StringBuilder();
userstr.Append(" select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
Database userdb = DatabaseFactory.CreateDatabase();
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
var userstr = new StringBuilder();
userstr.Append(" select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
Database userdb = DatabaseFactory.CreateDatabase();
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
{
str = "";
while (reader.Read())
{
str = "";
while (reader.Read())
var _corpid = Convert.ToString(reader["COMPANYID"]);
if (str == "")
{
if (str == "")
{
str = " (APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') ";
}
else
{
str = str + " or APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')";
};
str = " (SALECORPID='" + _corpid + "' ";
}
str = str + ")";
reader.Close();
else
{
str = str + " or SALECORPID='" + _corpid + "' ";
};
}
str = str + ")";
reader.Close();
}
}
@ -7172,26 +7174,27 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Settlement
else if (visiblerange == "5")
{
var userstr = new StringBuilder();
userstr.Append(" select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
Database userdb = DatabaseFactory.CreateDatabase();
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
var userstr = new StringBuilder();
userstr.Append(" select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
Database userdb = DatabaseFactory.CreateDatabase();
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
{
str = "";
while (reader.Read())
{
str = "";
while (reader.Read())
var _corpid= Convert.ToString(reader["COMPANYID"]);
if (str == "")
{
if (str == "")
{
str = " (APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') ";
}
else
{
str = str + " or APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')" ;
};
str = " (SALECORPID='"+ _corpid + "' ";
}
str = str + ")";
reader.Close();
else
{
str = str + " or SALECORPID='"+ _corpid + "' " ;
};
}
str = str + ")";
reader.Close();
}
}

Loading…
Cancel
Save