DS7Zhanhao
hanxuntao 2 years ago
parent 6ecbc3d456
commit 8dc10d1311

@ -1661,6 +1661,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
{ {
INVAPPMAX = true; INVAPPMAX = true;
} }
var invfeesumlist = new List<InvoiceFeeSum>();
if (ttlamount >= 99999 && INVAPPMAX) if (ttlamount >= 99999 && INVAPPMAX)
{ {
@ -1669,6 +1670,34 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
return result; return result;
} }
bool ischaoe = false; bool ischaoe = false;
var INVAMOUNTASSUM = MsSysParamSetDAL.GetData("PARAMNAME='INVAMOUNTASSUM'").PARAMVALUE;
//var invbodylist = GetBodyList("BILLNO='" + headData.BILLNO + "'");
//foreach (var invbody in invbodylist) {
// var invfeesum = invfeesumlist.Find(x=>x.CURR== invbody.ORIGCURRENCY&&x.exchange==invbody.EXCHANGERATE);
// if (invfeesum == null)
// {
// var newinvfeesum = new InvoiceFeeSum();
// newinvfeesum.CURR = invbody.ORIGCURRENCY;
// newinvfeesum.exchange = invbody.EXCHANGERATE;
// if (invbody.FEETYPE==1)
// newinvfeesum.amount = invbody.ORIGAMOUNT;
// else
// newinvfeesum.amount = -invbody.ORIGAMOUNT;
// invfeesumlist.Add(newinvfeesum);
// }
// else {
// if (invbody.FEETYPE == 1)
// invfeesum.amount = invfeesum.amount+invbody.ORIGAMOUNT;
// else invfeesum.amount = invfeesum.amount-invbody.ORIGAMOUNT;
// }
//}
var defGOOD = MsCodeGoodInvDAL.GetData(" ISDEF='1' and (DEFCURR='' or DEFCURR='" + headData.RECVCURR + "')"); var defGOOD = MsCodeGoodInvDAL.GetData(" ISDEF='1' and (DEFCURR='' or DEFCURR='" + headData.RECVCURR + "')");
Database db = DatabaseFactory.CreateDatabase(); Database db = DatabaseFactory.CreateDatabase();
using (var conn = db.CreateConnection()) using (var conn = db.CreateConnection())
@ -1795,11 +1824,40 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
else else
amtttl = amtttl + enumValue.DoAmount; amtttl = amtttl + enumValue.DoAmount;
ttlamount = ttlamount + amtttl; ttlamount = ttlamount + amtttl;
var invfeesum = invfeesumlist.Find(x => x.CURR == enumValue.Currency && x.exchange == enumValue.ExChangerate);
if (invfeesum == null)
{
var newinvfeesum = new InvoiceFeeSum();
newinvfeesum.CURR = enumValue.Currency;
newinvfeesum.exchange = enumValue.ExChangerate;
if (enumValue.FeeType == 1)
newinvfeesum.amount = enumValue.StlAmount;
else
newinvfeesum.amount = -enumValue.StlAmount;
invfeesumlist.Add(newinvfeesum);
}
else
{
if (enumValue.FeeType == 1)
invfeesum.amount = invfeesum.amount + enumValue.StlAmount;
else invfeesum.amount = invfeesum.amount - enumValue.StlAmount;
}
} }
} }
} }
acctaxrate = headData.EXCHANGERATE; acctaxrate = headData.EXCHANGERATE;
if (INVAMOUNTASSUM == "1")
{
amtttl = 0;
foreach (var invfeesum in invfeesumlist)
{
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList && amtttl != 0) { if (!isList && amtttl != 0) {
@ -1923,7 +1981,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
Database db = DatabaseFactory.CreateDatabase(); Database db = DatabaseFactory.CreateDatabase();
decimal amtttl = 0; decimal amtttl = 0;
decimal acctaxrate = 0; decimal acctaxrate = 0;
var invfeesumlist = new List<InvoiceFeeSum>();
bool INVAPPMAX = false; bool INVAPPMAX = false;
decimal ttlamount = headData.INVAMOUNT; decimal ttlamount = headData.INVAMOUNT;
var INVAPPMAXPARAM = MsSysParamSetDAL.GetData("PARAMNAME='INVAPPMAX'"); var INVAPPMAXPARAM = MsSysParamSetDAL.GetData("PARAMNAME='INVAPPMAX'");
@ -1931,7 +1989,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
{ {
INVAPPMAX = true; INVAPPMAX = true;
} }
var INVAMOUNTASSUM = MsSysParamSetDAL.GetData("PARAMNAME='INVAMOUNTASSUM'").PARAMVALUE;
if (ttlamount >= 99999 && INVAPPMAX) if (ttlamount >= 99999 && INVAPPMAX)
{ {
result.Success = false; result.Success = false;
@ -2046,6 +2104,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
amtttl = amtttl - enumValue.StlAmount; amtttl = amtttl - enumValue.StlAmount;
else else
amtttl = amtttl + enumValue.StlAmount; amtttl = amtttl + enumValue.StlAmount;
enumValue.ExChangerate =1;
} }
else else
{ {
@ -2059,7 +2119,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
amtttl = amtttl - Math.Round(enumValue.StlAmount * UExrate, 2, MidpointRounding.AwayFromZero); amtttl = amtttl - Math.Round(enumValue.StlAmount * UExrate, 2, MidpointRounding.AwayFromZero);
else else
amtttl = amtttl + Math.Round(enumValue.StlAmount * UExrate, 2, MidpointRounding.AwayFromZero); amtttl = amtttl + Math.Round(enumValue.StlAmount * UExrate, 2, MidpointRounding.AwayFromZero);
enumValue.ExChangerate = UExrate;
} }
@ -2077,6 +2137,27 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
db.ExecuteNonQuery(cmdInsert, tran); db.ExecuteNonQuery(cmdInsert, tran);
var invfeesum = invfeesumlist.Find(x => x.CURR == enumValue.Currency && x.exchange == enumValue.ExChangerate);
if (invfeesum == null)
{
var newinvfeesum = new InvoiceFeeSum();
newinvfeesum.CURR = enumValue.Currency;
newinvfeesum.exchange = enumValue.ExChangerate;
if (enumValue.FeeType == 1)
newinvfeesum.amount = enumValue.StlAmount;
else
newinvfeesum.amount = -enumValue.StlAmount;
invfeesumlist.Add(newinvfeesum);
}
else
{
if (enumValue.FeeType == 1)
invfeesum.amount = invfeesum.amount + enumValue.StlAmount;
else invfeesum.amount = invfeesum.amount - enumValue.StlAmount;
}
cmdUpdate.Parameters.Clear(); cmdUpdate.Parameters.Clear();
db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.CH_ID); db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.CH_ID);
db.AddInParameter(cmdUpdate, "@INVOICE", DbType.Decimal, enumValue.StlAmount); db.AddInParameter(cmdUpdate, "@INVOICE", DbType.Decimal, enumValue.StlAmount);
@ -2147,6 +2228,16 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice
} }
} }
acctaxrate = headData.EXCHANGERATE; acctaxrate = headData.EXCHANGERATE;
if (INVAMOUNTASSUM == "1")
{
amtttl = 0;
foreach (var invfeesum in invfeesumlist)
{
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList && amtttl != 0) if (!isList && amtttl != 0)
{ {

@ -1698,7 +1698,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{ {
INVAPPMAX = true; INVAPPMAX = true;
} }
var INVAMOUNTASSUM = MsSysParamSetDAL.GetData("PARAMNAME='INVAMOUNTASSUM'").PARAMVALUE;
var invfeesumlist = new List<InvoiceFeeSum>();
if (ttlamount >= 99999 && INVAPPMAX) if (ttlamount >= 99999 && INVAPPMAX)
{ {
result.Success = false; result.Success = false;
@ -1833,12 +1834,40 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
amtttl = amtttl - enumValue.DoAmount; amtttl = amtttl - enumValue.DoAmount;
else else
amtttl = amtttl + enumValue.DoAmount; amtttl = amtttl + enumValue.DoAmount;
var invfeesum = invfeesumlist.Find(x => x.CURR == enumValue.Currency && x.exchange == enumValue.ExChangerate);
if (invfeesum == null)
{
var newinvfeesum = new InvoiceFeeSum();
newinvfeesum.CURR = enumValue.Currency;
newinvfeesum.exchange = enumValue.ExChangerate;
if (enumValue.FeeType == 1)
newinvfeesum.amount = enumValue.StlAmount;
else
newinvfeesum.amount = -enumValue.StlAmount;
invfeesumlist.Add(newinvfeesum);
}
else
{
if (enumValue.FeeType == 1)
invfeesum.amount = invfeesum.amount + enumValue.StlAmount;
else invfeesum.amount = invfeesum.amount - enumValue.StlAmount;
}
} }
} }
} }
acctaxrate = headData.EXCHANGERATE; acctaxrate = headData.EXCHANGERATE;
if (INVAMOUNTASSUM == "1")
{
amtttl = 0;
foreach (var invfeesum in invfeesumlist)
{
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList&& amtttl!=0) { if (!isList&& amtttl!=0) {
@ -1971,7 +2000,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{ {
INVAPPMAX = true; INVAPPMAX = true;
} }
var INVAMOUNTASSUM = MsSysParamSetDAL.GetData("PARAMNAME='INVAMOUNTASSUM'").PARAMVALUE;
var invfeesumlist = new List<InvoiceFeeSum>();
if (ttlamount >= 99999 && INVAPPMAX) if (ttlamount >= 99999 && INVAPPMAX)
{ {
result.Success = false; result.Success = false;
@ -2085,6 +2115,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
amtttl = amtttl - enumValue.StlAmount; amtttl = amtttl - enumValue.StlAmount;
else else
amtttl = amtttl + enumValue.StlAmount; amtttl = amtttl + enumValue.StlAmount;
enumValue.ExChangerate =1;
} }
else else
{ {
@ -2098,6 +2129,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
amtttl = amtttl - Math.Round(enumValue.StlAmount * UExrate, 2); amtttl = amtttl - Math.Round(enumValue.StlAmount * UExrate, 2);
else else
amtttl = amtttl + Math.Round(enumValue.StlAmount * UExrate, 2); amtttl = amtttl + Math.Round(enumValue.StlAmount * UExrate, 2);
enumValue.ExChangerate = UExrate;
} }
@ -2116,6 +2148,26 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.ExecuteNonQuery(cmdInsert, tran); db.ExecuteNonQuery(cmdInsert, tran);
var invfeesum = invfeesumlist.Find(x => x.CURR == enumValue.Currency && x.exchange == enumValue.ExChangerate);
if (invfeesum == null)
{
var newinvfeesum = new InvoiceFeeSum();
newinvfeesum.CURR = enumValue.Currency;
newinvfeesum.exchange = enumValue.ExChangerate;
if (enumValue.FeeType == 1)
newinvfeesum.amount = enumValue.StlAmount;
else
newinvfeesum.amount = -enumValue.StlAmount;
invfeesumlist.Add(newinvfeesum);
}
else
{
if (enumValue.FeeType == 1)
invfeesum.amount = invfeesum.amount + enumValue.StlAmount;
else invfeesum.amount = invfeesum.amount - enumValue.StlAmount;
}
cmdUpdate.Parameters.Clear(); cmdUpdate.Parameters.Clear();
db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.CH_ID); db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.CH_ID);
db.AddInParameter(cmdUpdate, "@INVOICE", DbType.Decimal, enumValue.StlAmount); db.AddInParameter(cmdUpdate, "@INVOICE", DbType.Decimal, enumValue.StlAmount);
@ -2185,6 +2237,15 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
} }
} }
acctaxrate = headData.EXCHANGERATE; acctaxrate = headData.EXCHANGERATE;
if (INVAMOUNTASSUM == "1")
{
amtttl = 0;
foreach (var invfeesum in invfeesumlist)
{
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList&& amtttl!=0) if (!isList&& amtttl!=0)
{ {

@ -20,6 +20,7 @@ using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.Areas.Account.Models.TruckChfee_do_detail; using DSWeb.Areas.Account.Models.TruckChfee_do_detail;
using System.Data.SqlClient; using System.Data.SqlClient;
using DSWeb.Areas.Account.Models.Chfee_Invoice;
namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
{ {
@ -1642,7 +1643,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
{ {
INVAPPMAX = true; INVAPPMAX = true;
} }
var INVAMOUNTASSUM = MsSysParamSetDAL.GetData("PARAMNAME='INVAMOUNTASSUM'").PARAMVALUE;
var invfeesumlist = new List<InvoiceFeeSum>();
if (ttlamount >= 99999 && INVAPPMAX) if (ttlamount >= 99999 && INVAPPMAX)
{ {
result.Success = false; result.Success = false;
@ -1787,12 +1789,39 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
else else
amtttl = amtttl + doamount; amtttl = amtttl + doamount;
var invfeesum = invfeesumlist.Find(x => x.CURR == enumValue.Currency && x.exchange == enumValue.ExChangerate);
if (invfeesum == null)
{
var newinvfeesum = new InvoiceFeeSum();
newinvfeesum.CURR = enumValue.Currency;
newinvfeesum.exchange = enumValue.ExChangerate;
if (enumValue.FeeType == 1)
newinvfeesum.amount = enumValue.StlAmount;
else
newinvfeesum.amount = -enumValue.StlAmount;
invfeesumlist.Add(newinvfeesum);
}
else
{
if (enumValue.FeeType == 1)
invfeesum.amount = invfeesum.amount + enumValue.StlAmount;
else invfeesum.amount = invfeesum.amount - enumValue.StlAmount;
} }
}
} }
acctaxrate = headdata.RATE; acctaxrate = headdata.RATE;
if (INVAMOUNTASSUM == "1")
{
amtttl = 0;
foreach (var invfeesum in invfeesumlist)
{
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList&& amtttl != 0)
if (!isList&& ttlamount!=0)
{ {
var dataList = GetDetailList(" PID='" + GID + "'"); var dataList = GetDetailList(" PID='" + GID + "'");
@ -1919,7 +1948,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
{ {
INVAPPMAX = true; INVAPPMAX = true;
} }
var INVAMOUNTASSUM = MsSysParamSetDAL.GetData("PARAMNAME='INVAMOUNTASSUM'").PARAMVALUE;
var invfeesumlist = new List<InvoiceFeeSum>();
if (ttlamount >= 99999 && INVAPPMAX) if (ttlamount >= 99999 && INVAPPMAX)
{ {
result.Success = false; result.Success = false;
@ -2090,7 +2120,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
db.AddInParameter(cmdInsert, "@AMOUNT", DbType.Decimal, Math.Round(feettl, 2, MidpointRounding.AwayFromZero)); db.AddInParameter(cmdInsert, "@AMOUNT", DbType.Decimal, Math.Round(feettl, 2, MidpointRounding.AwayFromZero));
db.AddInParameter(cmdInsert, "@DOAMOUNT", DbType.Decimal, 0); db.AddInParameter(cmdInsert, "@DOAMOUNT", DbType.Decimal, 0);
db.AddInParameter(cmdInsert, "@EXCHANGERATE", DbType.Decimal, 1); db.AddInParameter(cmdInsert, "@EXCHANGERATE", DbType.Decimal, 1);
enumValue.ExChangerate = 1;
} }
@ -2102,7 +2132,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
db.AddInParameter(cmdInsert, "@DOAMOUNT", DbType.Decimal, 0); db.AddInParameter(cmdInsert, "@DOAMOUNT", DbType.Decimal, 0);
db.AddInParameter(cmdInsert, "@EXCHANGERATE", DbType.Decimal, UExrate); db.AddInParameter(cmdInsert, "@EXCHANGERATE", DbType.Decimal, UExrate);
enumValue.ExChangerate = UExrate;
} }
@ -2121,6 +2151,26 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
db.ExecuteNonQuery(cmdInsert, tran); db.ExecuteNonQuery(cmdInsert, tran);
var invfeesum = invfeesumlist.Find(x => x.CURR == enumValue.Currency && x.exchange == enumValue.ExChangerate);
if (invfeesum == null)
{
var newinvfeesum = new InvoiceFeeSum();
newinvfeesum.CURR = enumValue.Currency;
newinvfeesum.exchange = enumValue.ExChangerate;
if (enumValue.FeeType == 1)
newinvfeesum.amount = enumValue.StlAmount;
else
newinvfeesum.amount = -enumValue.StlAmount;
invfeesumlist.Add(newinvfeesum);
}
else
{
if (enumValue.FeeType == 1)
invfeesum.amount = invfeesum.amount + enumValue.StlAmount;
else invfeesum.amount = invfeesum.amount - enumValue.StlAmount;
}
cmdUpdate.Parameters.Clear(); cmdUpdate.Parameters.Clear();
db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.CH_ID); db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.CH_ID);
db.AddInParameter(cmdUpdate, "@ORDERINVOICE", DbType.Decimal, doamount); db.AddInParameter(cmdUpdate, "@ORDERINVOICE", DbType.Decimal, doamount);
@ -2179,6 +2229,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoiceapplication
} }
} }
acctaxrate = headdata.RATE; acctaxrate = headdata.RATE;
if (INVAMOUNTASSUM == "1")
{
amtttl = 0;
foreach (var invfeesum in invfeesumlist)
{
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList&& amtttl!=0) if (!isList&& amtttl!=0)
{ {

@ -486,4 +486,14 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice
} }
public class InvoiceFeeSum
{
public string CURR { get; set; }
public decimal amount { get; set; }
public decimal exchange { get; set; }
}
} }

@ -57,6 +57,7 @@ using DSWeb.Areas.MvcShipping.DAL.BookingConfirm;
using DSWeb.MvcContainer.DAL.MsOpCtnApply; using DSWeb.MvcContainer.DAL.MsOpCtnApply;
using DSWeb.Areas.SysMng.DAL.SysUser; using DSWeb.Areas.SysMng.DAL.SysUser;
using DSWeb.Common.DB; using DSWeb.Common.DB;
using DSWeb.Areas.Account.Models.BSNOLB;
//using Discuz.Common; //using Discuz.Common;
@ -2035,7 +2036,7 @@ namespace DSWeb.MvcShipping.Controllers
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data); var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
var errstr = ""; var errstr = "";
var itemClass = ""; var itemClass = "";
var BSNOLIST = new List<BSNOLB>();
if (headData != null) if (headData != null)
{ {
foreach (var enumValue in headData) foreach (var enumValue in headData)
@ -2072,6 +2073,9 @@ namespace DSWeb.MvcShipping.Controllers
MsOpSeaeDAL.DeleteDetail(BSNO); MsSysBillNoSetDAL.DeleteBsNo(enumValue.CUSTNO); MsOpSeaeDAL.DeleteDetail(BSNO); MsSysBillNoSetDAL.DeleteBsNo(enumValue.CUSTNO);
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + enumValue.BSNO + "','删除海运出口','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + enumValue.MBLNO + '(' + enumValue.CUSTOMERNAME + ')' + "','" + Convert.ToString(Session["USERID"]) + "')"; var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + enumValue.BSNO + "','删除海运出口','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + enumValue.MBLNO + '(' + enumValue.CUSTOMERNAME + ')' + "','" + Convert.ToString(Session["USERID"]) + "')";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL); bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
var NEWBSNO = new BSNOLB();
NEWBSNO.BSNO = enumValue.BSNO;
BSNOLIST.Add(NEWBSNO);
} }
} }
@ -2119,6 +2123,10 @@ namespace DSWeb.MvcShipping.Controllers
} }
} }
if (BSNOLIST != null && BSNOLIST.Count != 0)
MsOpSeaeEdiPortDAL.SendToDJYDel(BSNOLIST, Convert.ToString(Session["COMPANYID"]));
if (errstr == "") errstr = "删除成功!"; if (errstr == "") errstr = "删除成功!";
else errstr = errstr + "存在费用,请先删除费用才能删除此票业务!"; else errstr = errstr + "存在费用,请先删除费用才能删除此票业务!";
if (itemClass == "网上订舱不能删除") { errstr = "网上订舱不能删除"; } if (itemClass == "网上订舱不能删除") { errstr = "网上订舱不能删除"; }
@ -2366,7 +2374,7 @@ namespace DSWeb.MvcShipping.Controllers
iscancel = false; iscancel = false;
} }
if (iscancel) if (iscancel)
MsOpSeaeDAL.CancelShippingOrder(BSNO, type, Convert.ToString(Session["SHOWNAME"]), CANCELDELCTN); MsOpSeaeDAL.CancelShippingOrder(BSNO, type, Convert.ToString(Session["SHOWNAME"]), CANCELDELCTN, Convert.ToString(Session["COMPANYID"]));
} }
else else
{ {
@ -2423,7 +2431,7 @@ namespace DSWeb.MvcShipping.Controllers
} }
if (iscancel) if (iscancel)
MsOpSeaeDAL.CancelShippingOrder(BSNO, type, Convert.ToString(Session["SHOWNAME"]), CANCELDELCTN); MsOpSeaeDAL.CancelShippingOrder(BSNO, type, Convert.ToString(Session["SHOWNAME"]), CANCELDELCTN, Convert.ToString(Session["COMPANYID"]));
} }

@ -157,6 +157,8 @@ namespace DSWeb.MvcShipping.DAL.MsCwDesignGlDAL
data.ISRPSTLDATE = (reader["ISRPSTLDATE"] == null ? false : Convert.ToBoolean(reader["ISRPSTLDATE"]));//结算生成成本凭证结算日期为凭证日期 data.ISRPSTLDATE = (reader["ISRPSTLDATE"] == null ? false : Convert.ToBoolean(reader["ISRPSTLDATE"]));//结算生成成本凭证结算日期为凭证日期
if (reader["ISSTLDRCRISGROUP"] != DBNull.Value) if (reader["ISSTLDRCRISGROUP"] != DBNull.Value)
data.ISSTLDRCRISGROUP = (reader["ISSTLDRCRISGROUP"] == null ? false : Convert.ToBoolean(reader["ISSTLDRCRISGROUP"]));//结算凭证应收应付账款合并 data.ISSTLDRCRISGROUP = (reader["ISSTLDRCRISGROUP"] == null ? false : Convert.ToBoolean(reader["ISSTLDRCRISGROUP"]));//结算凭证应收应付账款合并
if (reader["ISINVAMOUNTASSUM"] != DBNull.Value)
data.ISINVAMOUNTASSUM = (reader["ISINVAMOUNTASSUM"] == null ? false : Convert.ToBoolean(reader["ISINVAMOUNTASSUM"]));//销项发票根据开票金额生成凭证
data.AR = (reader["AR"] == null ? "" : Convert.ToString(reader["AR"]));//应收账款 data.AR = (reader["AR"] == null ? "" : Convert.ToString(reader["AR"]));//应收账款
data.ARFC = (reader["ARFC"] == null ? "" : Convert.ToString(reader["ARFC"]));//应收账款外币 data.ARFC = (reader["ARFC"] == null ? "" : Convert.ToString(reader["ARFC"]));//应收账款外币
data.AP = (reader["AP"] == null ? "" : Convert.ToString(reader["AP"]));//应付账款 data.AP = (reader["AP"] == null ? "" : Convert.ToString(reader["AP"]));//应付账款

@ -244,6 +244,7 @@ namespace DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceDAL
int iResult = 0; int iResult = 0;
string zt = ""; string zt = "";
string sError = "操作完成!"; string sError = "操作完成!";
var invlist = strGids.Split(',');
string sAndGids = " and GID in ('" + strGids.Trim().Replace(",", "','") + "')"; string sAndGids = " and GID in ('" + strGids.Trim().Replace(",", "','") + "')";
var CWSTARTUSING = MsSysParamSetDAL.GetData("PARAMNAME='CWSTARTUSING'"); var CWSTARTUSING = MsSysParamSetDAL.GetData("PARAMNAME='CWSTARTUSING'");
@ -338,9 +339,17 @@ namespace DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceDAL
// //
if (iCount != 0) if (iCount != 0)
{ {
if (dsCwDesign.Tables[0].Rows[0]["ISINVRATESELF"].ToString().Trim() == "True")
iResult = getInvSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK); if (dsCwDesign.Tables[0].Rows[0]["ISINVAMOUNTASSUM"].ToString().Trim() == "True")
else iResult = getHxtSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK); {
iResult = getInvSumSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK, invlist);
}
else
{
if (dsCwDesign.Tables[0].Rows[0]["ISINVRATESELF"].ToString().Trim() == "True")
iResult = getInvSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK);
else iResult = getHxtSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK);
}
zt += "," + iResult; zt += "," + iResult;
if (zt.IndexOf("-") > 0) if (zt.IndexOf("-") > 0)
{ {
@ -398,10 +407,19 @@ namespace DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceDAL
// //
if (iCount != 0) if (iCount != 0)
{ {
if (dsCwDesign.Tables[0].Rows[0]["ISINVRATESELF"].ToString().Trim() == "True") if (dsCwDesign.Tables[0].Rows[0]["ISINVAMOUNTASSUM"].ToString().Trim() == "True")
iResult = getInvSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK); {
iResult = getInvSumSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK, invlist);
}
else else
iResult = getHxtSC(dsCwDesign, dsCwDesignItem, sAndGids, headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK); {
if (dsCwDesign.Tables[0].Rows[0]["ISINVRATESELF"].ToString().Trim() == "True")
iResult = getInvSC(dsCwDesign, dsCwDesignItem, sAndGids.Trim(), headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK);
else
iResult = getHxtSC(dsCwDesign, dsCwDesignItem, sAndGids, headData, bodyList, strUserID, companyid, cfVOUALLNO, VOUAUTOCHECK);
}
zt += "," + iResult; zt += "," + iResult;
if (zt.IndexOf("-") < 0) if (zt.IndexOf("-") < 0)
{ {
@ -430,7 +448,7 @@ namespace DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceDAL
result.Message = sError;//"操作完成!"; result.Message = sError;//"操作完成!";
return result; return result;
} }
/// <summary> /// <summary>
/// 生成凭证 /// 生成凭证
/// </summary> /// </summary>
@ -439,6 +457,555 @@ namespace DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceDAL
/// <returns></returns> /// <returns></returns>
/// ///
/* 按发票开票金额生成凭证*/
protected static int getInvSumSC(DataSet dsCwDesign, DataSet dsCwDesignItem, string sAndGids, MsCwVouchersGl3 headData, List<MsCwVouchersGl4> bodyList, string strUserID, string strCompanyID, string cfVOUALLNO, string VOUAUTOCHECK,string[] invlist)
{
var result = new DBResult();
#region 基本变量
//全部
string sSQL = "";
string strEXPLAN = "";
string strFCY = "RMB";
Decimal dEXCHANGERATE = 0;
//应收应付账款
Decimal iAMTDR = 0;
Decimal iAMTCR = 0;
//差额主营业务收入
Decimal dRMBS = 0;
Decimal dRMBF = 0;
Decimal dUSDS = 0;
Decimal dUSDF = 0;
//总合计
//Decimal strJie = 0;
//Decimal strDai = 0;
string strBPVW = dsCwDesign.Tables[0].Rows[0]["TVW"].ToString().Trim();
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
string strCwACCDATE = BasicDataRefDAL.GetCwACCDATE(strUserID);
string strCwSTARTGID = BasicDataRefDAL.GetCwSTARTGID(strUserID);
#endregion
#region 科目设置
//科目设置 应收RMB
sSQL = "SELECT top 1 * from cw_accitems_gl where [YEAR]=SUBSTRING('" + strCwACCDATE + "',1,4) and [STARTGID]='" + strCwSTARTGID + "' and ACCID='" + dsCwDesign.Tables[0].Rows[0]["AR"].ToString().Trim() + "'";
DataSet dsAR = T_ALL_DA.GetAllSQL(sSQL);
//科目设置 应收USD
sSQL = "SELECT top 1 * from cw_accitems_gl where [YEAR]=SUBSTRING('" + strCwACCDATE + "',1,4) and [STARTGID]='" + strCwSTARTGID + "' and ACCID='" + dsCwDesign.Tables[0].Rows[0]["ARFC"].ToString().Trim() + "'";
DataSet dsARFC = T_ALL_DA.GetAllSQL(sSQL);
//主营业务收入 收入RMB
sSQL = "SELECT top 1 * from cw_accitems_gl where [YEAR]=SUBSTRING('" + strCwACCDATE + "',1,4) and [STARTGID]='" + strCwSTARTGID + "' and ACCID='" + dsCwDesign.Tables[0].Rows[0]["MBINCOME"].ToString().Trim() + "'";
DataSet dsMBINCOME = T_ALL_DA.GetAllSQL(sSQL);
//主营收入外币 收入USD
sSQL = "SELECT top 1 * from cw_accitems_gl where [YEAR]=SUBSTRING('" + strCwACCDATE + "',1,4) and [STARTGID]='" + strCwSTARTGID + "' and ACCID='" + dsCwDesign.Tables[0].Rows[0]["TMFCI"].ToString().Trim() + "'";
DataSet dsTMFCI = T_ALL_DA.GetAllSQL(sSQL);
//销项税
sSQL = "SELECT top 1 * from cw_accitems_gl where [YEAR]=SUBSTRING('" + strCwACCDATE + "',1,4) and [STARTGID]='" + strCwSTARTGID + "' and ACCID='" + dsCwDesign.Tables[0].Rows[0]["OUTPUTTAX"].ToString().Trim() + "'";
DataSet dsOUTPUTTAX = T_ALL_DA.GetAllSQL(sSQL);
#endregion
string DREXPLAN = dsCwDesign.Tables[0].Rows[0]["INVDREXPLAN"].ToString().Trim();
string CREXPLAN = dsCwDesign.Tables[0].Rows[0]["INVCREXPLAN"].ToString().Trim();
string MBINCOMEEXPLAN = dsCwDesign.Tables[0].Rows[0]["INVMBINCOMEEXPLAN"].ToString().Trim();
string MBSPENDINGEXPLAN = dsCwDesign.Tables[0].Rows[0]["INVMBSPENDINGEXPLAN"].ToString().Trim();
#region 摘要
string strISEXPLAN = "";
if (dsCwDesign.Tables[0].Rows[0]["ISCLIENTNAME"].ToString().Trim() == "True")
{
strISEXPLAN += ",CUSTOMERNAME";//是否收付客户名称CUSTOMERNAME
}
if (dsCwDesign.Tables[0].Rows[0]["ISCUSTNO"].ToString().Trim() == "True")
{
strISEXPLAN += ",INVOICENO";//是否委托编号CUSTNO//发票号
}
if (dsCwDesign.Tables[0].Rows[0]["ISMBLNO"].ToString().Trim() == "True")
{
strISEXPLAN += ",MBLNO";//是否主提单号
}
if (dsCwDesign.Tables[0].Rows[0]["ISSALE"].ToString().Trim() == "True")
{
strISEXPLAN += ",SALE";//是否主提单号
}
//if (dsCwDesign.Tables[0].Rows[0]["ISVESSEL"].ToString().Trim() == "True")
//{
// strISEXPLAN += ",VESSEL";//是否船名
//}
//if (dsCwDesign.Tables[0].Rows[0]["ISVOYNO"].ToString().Trim() == "True")
//{
// strISEXPLAN += ",VOYNO";//是否航次
//}
//if (dsCwDesign.Tables[0].Rows[0]["ISBSSOURCE"].ToString().Trim() == "True")
//{
// strISEXPLAN += ",BSSOURCE";//是否业务来源
//}
string strISEXPLANnull = "";
if (dsCwDesign.Tables[0].Rows[0]["ISMBINCOME"].ToString().Trim() == "False")//是否合并生成发票开出凭证中的主营业务科目
{
if (dsCwDesign.Tables[0].Rows[0]["ISCLIENTNAME"].ToString().Trim() == "True")
{
strISEXPLANnull += ",CUSTOMERNAME";//是否收付客户名称CUSTOMERNAME
}
if (dsCwDesign.Tables[0].Rows[0]["ISCUSTNO"].ToString().Trim() == "True")
{
strISEXPLANnull += ",INVOICENO";//是否委托编号CUSTNO//发票号
}
if (dsCwDesign.Tables[0].Rows[0]["ISMBLNO"].ToString().Trim() == "True")
{
strISEXPLANnull += ",MBLNO";//是否主提单号
}
if (dsCwDesign.Tables[0].Rows[0]["ISSALE"].ToString().Trim() == "True")
{
strISEXPLANnull += ",SALE";//是否主提单号
}
//if (dsCwDesign.Tables[0].Rows[0]["ISVESSEL"].ToString().Trim() == "True")
//{
// strISEXPLANnull += ",VESSEL";//是否船名
//}
//if (dsCwDesign.Tables[0].Rows[0]["ISVOYNO"].ToString().Trim() == "True")
//{
// strISEXPLANnull += ",VOYNO";//是否航次
//}
//if (dsCwDesign.Tables[0].Rows[0]["ISBSSOURCE"].ToString().Trim() == "True")
//{
// strISEXPLANnull += ",BSSOURCE";//是否业务来源
//}
//if (dsCwDesign.Tables[0].Rows[0]["ISBILLNO"].ToString().Trim() == "True")
//{
// strISEXPLANnull += ",BILLNO_ACAD";//是否申请单号
//}
}
#endregion
#region 票号
if (strISEXPLAN.IndexOf(dsCwDesign.Tables[0].Rows[0]["PiaoHao"].ToString().Trim()) < 0)
{
strISEXPLAN += "," + dsCwDesign.Tables[0].Rows[0]["PiaoHao"].ToString().Trim();
}
if (dsCwDesign.Tables[0].Rows[0]["ISMBINCOME"].ToString().Trim() == "False")//是否合并生成发票开出凭证中的主营业务科目
{
if (strISEXPLANnull.IndexOf(dsCwDesign.Tables[0].Rows[0]["PiaoHao"].ToString().Trim()) < 0)
{
strISEXPLANnull += "," + dsCwDesign.Tables[0].Rows[0]["PiaoHao"].ToString().Trim();
}
}
#endregion
#region 核算科目_分录
//string sqlItemAR = "";
//string sqlItemARFC = "";
//string sqlItemMBINCOME = "";
//string sqlItemTMFCI = "";
#endregion
#region 基本数据集
string strORDNO = getGid();
string sqlAR = "";
string sqlARFC = "";
string sqlMBINCOME = "";
string sqlTMFCI = "";
string sqlOUTPUTTAX = "";
string sqlOUTPUTTAXUSD = "";
IList<MsCwVouitemsGl> CwVouitemsEntities = new List<MsCwVouitemsGl>();
string strCondition = sAndGids + " and GID in (select [BSGID] from [cw_vouno_bs_gl] WITH(NOLOCK) where BSTABLENAME='ch_fee_invoice' and VOUALLNO='" + cfVOUALLNO + "' and STARTGID='" + strCwSTARTGID + "')";
//是否按照系统录入汇率
#endregion
sqlARFC = "SELECT * from ch_fee_invoice WHERE 1=1" + strCondition ;
DataSet dsVWChFeeAR = T_ALL_DA.GetAllSQL(sqlARFC);
Decimal strJie = 0;
Decimal strDai = 0;
if (dsVWChFeeAR != null)
{
int n = 1;
foreach (var invgid in invlist) {
for (int i = 0; i < dsVWChFeeAR.Tables[0].Rows.Count; i++)
{
if (dsVWChFeeAR.Tables[0].Rows[i]["GID"].ToString().Trim() == invgid) {
#region 摘要内容
strEXPLAN = "";
strEXPLAN = DREXPLAN;
var ISEXPLAN = false;
if (strEXPLAN != "") ISEXPLAN = true;
if (ISEXPLAN)
{
strEXPLAN = strEXPLAN.Replace("[发票抬头]", dsVWChFeeAR.Tables[0].Rows[i]["INVOICECUSTNAME"].ToString().Trim());
strEXPLAN = strEXPLAN.Replace("[发票号]", dsVWChFeeAR.Tables[0].Rows[i]["INVOICENO"].ToString().Trim());
}
else
{
strEXPLAN += "应收 " + dsVWChFeeAR.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim() + dsVWChFeeAR.Tables[0].Rows[i]["INVOICENO"].ToString().Trim();
}
#endregion
#region 应收账款
MsCwVouitemsGl MsCwVouitemsGl = new MsCwVouitemsGl();
//MsCwVouitemsGl.GID 唯一编码 newid()
MsCwVouitemsGl.ORDNO = strORDNO.Trim();
MsCwVouitemsGl.ITEMNO = n;// 行号
MsCwVouitemsGl.PACCID = "";//父级科目贷码
MsCwVouitemsGl.PROPERTY = 0;//科目属性
MsCwVouitemsGl.GRADE = 0;//科目级别
#region 应收账款
if (dsVWChFeeAR.Tables[0].Rows[i]["OTCURRAMOUNT"].ToString().Trim() == "0")
{
iAMTDR = iAMTDR + Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());
//
MsCwVouitemsGl.ACCID = dsCwDesign.Tables[0].Rows[0]["AR"].ToString().Trim();//应收账款科目贷码
MsCwVouitemsGl.AMTDR = Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());//本位币借方金额(互斥)
MsCwVouitemsGl.AMTCR = 0;//本位币贷方金额(互斥)
MsCwVouitemsGl.ISFCY = false;//是否外币
MsCwVouitemsGl.FCYNO = "RMB";//外币编号usd
MsCwVouitemsGl.FCYDR = 0;//外币借方金额
MsCwVouitemsGl.FCYCR = 0;//外币贷方金额
dRMBS += Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());//本位币借方金额(互斥)
MsCwVouitemsGl.ACCNAME = dsAR.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称
MsCwVouitemsGl.ISDEPTACC = Boolean.Parse(dsAR.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成
MsCwVouitemsGl.ISEMPLACC = Boolean.Parse(dsAR.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成
MsCwVouitemsGl.ISCORPACC = Boolean.Parse(dsAR.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成
MsCwVouitemsGl.ISITEMACC = Boolean.Parse(dsAR.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成
if (dsAR.Tables[0].Rows[0]["DC"].ToString().Trim() == "借")
{
MsCwVouitemsGl.DC = "D";//借方向
}
else
{
MsCwVouitemsGl.DC = "C";//贷方向
}
}
else
{
iAMTDR = iAMTDR + Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());
//
MsCwVouitemsGl.ACCID = dsCwDesign.Tables[0].Rows[0]["ARFC"].ToString().Trim();//应收账款科目贷码
MsCwVouitemsGl.AMTDR = Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());//本位币借方金额(互斥)
MsCwVouitemsGl.AMTCR = 0;//本位币贷方金额(互斥)
MsCwVouitemsGl.ISFCY = true;//是否外币
MsCwVouitemsGl.FCYNO = dsVWChFeeAR.Tables[0].Rows[i]["RECVCURR"].ToString();//外币编号usd
MsCwVouitemsGl.FCYDR = Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["OTCURRAMOUNT"].ToString().Trim());//外币借方金额
MsCwVouitemsGl.FCYCR = 0;//外币贷方金额
dRMBS += Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());//本位币借方金额(互斥)
MsCwVouitemsGl.ACCNAME = dsARFC.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称
MsCwVouitemsGl.ISDEPTACC = Boolean.Parse(dsARFC.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成
MsCwVouitemsGl.ISEMPLACC = Boolean.Parse(dsARFC.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成
MsCwVouitemsGl.ISCORPACC = Boolean.Parse(dsARFC.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成
MsCwVouitemsGl.ISITEMACC = Boolean.Parse(dsARFC.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成
if (dsARFC.Tables[0].Rows[0]["DC"].ToString().Trim() == "借")
{
MsCwVouitemsGl.DC = "D";//借方向
}
else
{
MsCwVouitemsGl.DC = "C";//贷方向
}
}
strJie = strJie + MsCwVouitemsGl.AMTCR;
//
string strACCALL = "";
//是否核算客户
MsCwVouitemsGl.CORPID = "";//客户(系统)
MsCwVouitemsGl.CUSTOMERNAME = "";//客户(系统)
if (dsAR.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim() == "True")
{
MsCwVouitemsGl.CORPID = "";//客户(系统)
MsCwVouitemsGl.CUSTOMERNAME = dsVWChFeeAR.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//客户(系统)
strACCALL += "▁" + MsCwVouitemsGl.CUSTOMERNAME;
}
MsCwVouitemsGl.EXPLAN = strEXPLAN;//摘要
MsCwVouitemsGl.FCYEXRATE = 1;//汇率
dEXCHANGERATE = 1;//汇率
MsCwVouitemsGl.BLNO = "";
//string strBLNONAME = dsCwDesign.Tables[0].Rows[0]["PiaoHao"].ToString().Trim();
//if (strBLNONAME.Trim() != "")
//{
// MsCwVouitemsGl.BLNO = dsVWChFeeAR.Tables[0].Rows[i][strBLNONAME].ToString().Trim();
//}
if (dsCwDesign.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True")
{
MsCwVouitemsGl.ISSYS = false;//是否手动录入
}
else
{
MsCwVouitemsGl.ISSYS = true;//是否手动录入
}
if (dsVWChFeeAR.Tables[0].Rows[i]["OTCURRAMOUNT"].ToString().Trim() == "0")
{
MsCwVouitemsGl.ACCALL = BasicDataRefDAL.setCAGA(dsAR.Tables[0].Rows[0]["PACCGID"].ToString(), MsCwVouitemsGl.ACCNAME.ToString().Trim()) + strACCALL;
}
else
{
MsCwVouitemsGl.ACCALL = BasicDataRefDAL.setCAGA(dsARFC.Tables[0].Rows[0]["PACCGID"].ToString(), MsCwVouitemsGl.ACCNAME.ToString().Trim()) + strACCALL;
}
#endregion
MsCwVouitemsGl.QTYUNIT = "";//数量包装单位
MsCwVouitemsGl.QTYDR = 0;//借方数量
MsCwVouitemsGl.QTYCR = 0;//贷方数量
MsCwVouitemsGl.DEPTID = "";//部门(系统)
MsCwVouitemsGl.EMPLID = "";//人员(系统)
MsCwVouitemsGl.PITEMID = 0;//父级项目编号
MsCwVouitemsGl.ITEMID = "";//项目编号
MsCwVouitemsGl.FIELD1 = "";//预留字段1
MsCwVouitemsGl.FIELD2 = "";//预留字段2
MsCwVouitemsGl.FIELD3 = "";//预留字段3
MsCwVouitemsGl.FIELD4 = "";//预留字段4
MsCwVouitemsGl.FIELD5 = "";//预留字段5
MsCwVouitemsGl.FIELD6 = "";//预留字段6
MsCwVouitemsGl.FIELD7 = "";//预留字段7
MsCwVouitemsGl.FIELD8 = "";//预留字段8
MsCwVouitemsGl.FIELD9 = "";//预留字段9
MsCwVouitemsGl.FIELD10 = "";//预留字段10
MsCwVouitemsGl.FSETTLCODE = "";//结算方式
MsCwVouitemsGl.FSETTLENO = "";//财务辅助编号
MsCwVouitemsGl.FSETTLDATE = DateTime.Parse(DateTime.Parse(headData.VOUDATE).ToString("yyyy-MM-dd"));//结算日期
MsCwVouitemsGl.CREATEUSER = strUserID;//创建人
MsCwVouitemsGl.CREATETIME = DateTime.Now;//创建时间
MsCwVouitemsGl.MODIFIEDUSER = strUserID;//最后一次更新操作人
MsCwVouitemsGl.MODIFIEDTIME = DateTime.Now;//最后一次更新操作时间
#endregion
CwVouitemsEntities.Add(MsCwVouitemsGl);
#region 摘要内容
strEXPLAN = "";
strEXPLAN = MBINCOMEEXPLAN;
ISEXPLAN = false;
if (strEXPLAN != "") ISEXPLAN = true;
if (ISEXPLAN)
{
strEXPLAN = strEXPLAN.Replace("[发票抬头]", dsVWChFeeAR.Tables[0].Rows[i]["INVOICECUSTNAME"].ToString().Trim());
strEXPLAN = strEXPLAN.Replace("[发票号]", dsVWChFeeAR.Tables[0].Rows[i]["INVOICENO"].ToString().Trim());
}
else
{
strEXPLAN += "应收 " + dsVWChFeeAR.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim() + dsVWChFeeAR.Tables[0].Rows[i]["INVOICENO"].ToString().Trim();
}
#endregion
#region 收入
n++;
MsCwVouitemsGl = new MsCwVouitemsGl();
//MsCwVouitemsGl.GID 唯一编码 newid()
MsCwVouitemsGl.ORDNO = strORDNO.Trim();
MsCwVouitemsGl.ITEMNO = n;//行号
MsCwVouitemsGl.PACCID = "";//父级科目贷码
MsCwVouitemsGl.PROPERTY = 0;//科目属性
MsCwVouitemsGl.GRADE = 0;//科目级别
MsCwVouitemsGl.ACCID = dsCwDesign.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码
MsCwVouitemsGl.AMTDR = 0;//本位币借方金额(互斥)
MsCwVouitemsGl.AMTCR = Decimal.Parse(dsVWChFeeAR.Tables[0].Rows[i]["INVAMOUNT"].ToString().Trim());//本位币贷方金额(互斥)
strDai = strDai + MsCwVouitemsGl.AMTCR;
MsCwVouitemsGl.ISFCY = false;//是否外币
MsCwVouitemsGl.FCYNO = "RMB";//外币
MsCwVouitemsGl.FCYDR = 0;//外币借方金额
MsCwVouitemsGl.FCYCR = 0;//外币贷方金额
MsCwVouitemsGl.ACCNAME = dsMBINCOME.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称
MsCwVouitemsGl.ISDEPTACC = Boolean.Parse(dsMBINCOME.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成
MsCwVouitemsGl.ISEMPLACC = Boolean.Parse(dsMBINCOME.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成
MsCwVouitemsGl.ISCORPACC = Boolean.Parse(dsMBINCOME.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成
MsCwVouitemsGl.ISITEMACC = Boolean.Parse(dsMBINCOME.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成
if (dsMBINCOME.Tables[0].Rows[0]["DC"].ToString().Trim() == "借")
{
MsCwVouitemsGl.DC = "D";//借方向
}
else
{
MsCwVouitemsGl.DC = "C";//贷方向
}
//
strACCALL = "";
MsCwVouitemsGl.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户
MsCwVouitemsGl.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户
if (dsMBINCOME.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim() == "True")
{
MsCwVouitemsGl.CORPID = "";//客户(系统)
MsCwVouitemsGl.CUSTOMERNAME = dsVWChFeeAR.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//客户(系统)
strACCALL += "▁" + MsCwVouitemsGl.CUSTOMERNAME;
}
MsCwVouitemsGl.ACCALL = BasicDataRefDAL.setCAGA(dsMBINCOME.Tables[0].Rows[0]["PACCGID"].ToString(), MsCwVouitemsGl.ACCNAME.ToString().Trim()) + strACCALL;
MsCwVouitemsGl.FCYEXRATE = 1;//汇率
if (dsCwDesign.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True")
{
MsCwVouitemsGl.ISSYS = false;//是否手动录入
}
else
{
MsCwVouitemsGl.ISSYS = true;//是否手动录入
}
MsCwVouitemsGl.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" +
MsCwVouitemsGl.BLNO = "";//
MsCwVouitemsGl.QTYUNIT = "";//数量包装单位
MsCwVouitemsGl.QTYDR = 0;//借方数量
MsCwVouitemsGl.QTYCR = 0;//贷方数量
MsCwVouitemsGl.DEPTID = "";//部门(系统)
MsCwVouitemsGl.EMPLID = "";//人员(系统)
MsCwVouitemsGl.PITEMID = 0;//父级项目编号
MsCwVouitemsGl.ITEMID = "";//项目编号
MsCwVouitemsGl.FIELD1 = "";//预留字段1
MsCwVouitemsGl.FIELD2 = "";//预留字段2
MsCwVouitemsGl.FIELD3 = "";//预留字段3
MsCwVouitemsGl.FIELD4 = "";//预留字段4
MsCwVouitemsGl.FIELD5 = "";//预留字段5
MsCwVouitemsGl.FIELD6 = "";//预留字段6
MsCwVouitemsGl.FIELD7 = "";//预留字段7
MsCwVouitemsGl.FIELD8 = "";//预留字段8
MsCwVouitemsGl.FIELD9 = "";//预留字段9
MsCwVouitemsGl.FIELD10 = "";//预留字段10
MsCwVouitemsGl.FSETTLCODE = "";//结算方式
MsCwVouitemsGl.FSETTLENO = "";//财务辅助编号
MsCwVouitemsGl.FSETTLDATE = DateTime.Parse(DateTime.Parse(headData.VOUDATE).ToString("yyyy-MM-dd"));//结算日期
MsCwVouitemsGl.CREATEUSER = strUserID;//创建人
MsCwVouitemsGl.CREATETIME = DateTime.Now;//创建时间
MsCwVouitemsGl.MODIFIEDUSER = strUserID;//最后一次更新操作人
MsCwVouitemsGl.MODIFIEDTIME = DateTime.Now;//最后一次更新操作时间
#endregion
CwVouitemsEntities.Add(MsCwVouitemsGl);
n++;
}
}
}
}
if (CwVouitemsEntities.Count == 0)
{
//删除ch_fee_invoice中未生成的凭证号
//string blSQL = "update ch_fee_invoice set VOUNO='' where VOUNO='" + cfVOUALLNO + "'" + sAndGids.Trim();
//删除凭证生成关系表中的ch_fee_invoice的GID数据
string strLS = sAndGids.Replace("GID", "BSGID");
string blSQL = "delete from [cw_vouno_bs_gl] where VOUALLNO='" + cfVOUALLNO + "' and BSTABLENAME='ch_fee_invoice' and [STARTGID]='" + strCwSTARTGID + "'" + strLS;
bool bl = T_ALL_DA.GetExecuteSqlCommand(blSQL);
return -3;//结算无明细数据
}
else
{
#region 插入主表
MsCwVouchersGl MsCwVouchersGl = new MsCwVouchersGl();
MsCwVouchersGl.ORDNO = strORDNO.Trim();//唯一编码 newid() varchar (36)
MsCwVouchersGl.VOUDATE = headData.VOUDATE;//凭证日期
//strY + "~" + strM + "~" + sVOUNO + "~" + strVOUNO + "~" + strVOUDATE + "~" + strACCDATE;
//string sACCDATE = headData.VOUDATE.Substring(0, 7);
//if (DateTime.Parse(sACCDATE + "-01") < DateTime.Parse(strACCDATE + "-01"))
//{
// sACCDATE = strACCDATE;
//}
//string strVOUNOhj = DSWeb.MvcShipping.DAL.MsBaseInfoDAL.MsBaseInfoDAL.GetCwVOUNO(strBPVW.Trim(), sACCDATE);
//string[] items = strVOUNOhj.Trim().Split(new string[] { "~" }, StringSplitOptions.RemoveEmptyEntries);
//string sVOUNO = items[2].ToString().Trim();
//string strVOUNO = items[3].ToString().Trim();
MsCwVouchersGl.VOUNO = int.Parse(cfVOUALLNO.Substring(cfVOUALLNO.Length - 4)).ToString();//sVOUNO;//月初清零 varchar (16)
MsCwVouchersGl.ACCYEAR = DateTime.Parse(headData.VOUDATE.ToString()).Year.ToString();//年
MsCwVouchersGl.ACCMONTH = DateTime.Parse(headData.VOUDATE.ToString()).Month.ToString();//月
if (MsCwVouchersGl.ACCMONTH.ToString().Length == 1)
{
MsCwVouchersGl.ACCMONTH = "0" + MsCwVouchersGl.ACCMONTH.ToString();//月
}
MsCwVouchersGl.VKNO = strBPVW.Trim();//凭证字
//MsCwVouchersGl.VOUALLNO = MsCwVouchersGl.VKNO + MsCwVouchersGl.ACCYEAR + MsCwVouchersGl.ACCMONTH + strVOUNO;//年+月+自动生成编号=凭证号
MsCwVouchersGl.VOUALLNO = cfVOUALLNO.Replace("记", strBPVW.Trim());//年+月+自动生成编号=凭证号
MsCwVouchersGl.ATTACHS = 1;// int.Parse(dsCwDesign.Tables[0].Rows[0]["AFFIXNO"].ToString().Trim());//附件(单据)数
MsCwVouchersGl.AMTDR = strJie;// iAMTDR;//本位币借方
MsCwVouchersGl.AMTCR = strDai;//iAMTDR;// iAMTCR;//本位币贷方
MsCwVouchersGl.FCY = strFCY;//是否含有外币科目
MsCwVouchersGl.QTY = "";//是否含有数量科目
MsCwVouchersGl.VOUPROP = "";//凭证属性
MsCwVouchersGl.PREPARED = headData.PREPARED.ToString().Trim();//制单人
MsCwVouchersGl.CHECKED = "";//审核人
MsCwVouchersGl.ENTERED = "";//记账人
MsCwVouchersGl.ERRMSG = "";//错误信息
MsCwVouchersGl.ISDELETE = false;//是否废除
MsCwVouchersGl.DELETEUSER = "";//废除操作人
MsCwVouchersGl.STARTGID = strCwSTARTGID;
MsCwVouchersGl.DbOperationType = DbOperationType.DbotIns;
MsCwVouchersGl.CREATEUSER = strUserID;//创建人
MsCwVouchersGl.CREATETIME = DateTime.Now;//创建时间
MsCwVouchersGl.MODIFIEDUSER = strUserID;//最后一次更新操作人
MsCwVouchersGl.MODIFIEDTIME = DateTime.Now;//最后一次更新操作时间
MsCwVouchersGl.ISAUTO = true;
#endregion
#region 生成入库
var modb = new ModelObjectDB();
result = modb.Save(MsCwVouchersGl);
if (result.Success == true)
{
foreach (var enumValue in CwVouitemsEntities)
{
enumValue.GID = Guid.NewGuid().ToString();
//enumValue.ITEMNO = n;
enumValue.DbOperationType = DbOperationType.DbotIns;
var modb2 = new ModelObjectDB();
DBResult result2 = modb2.Save(enumValue);
}
//更新凭证生成关系表中的ORDNO数据
string strLS = sAndGids.Replace("GID", "BSGID");
string blSQL = "update [cw_vouno_bs_gl] set ORDNO='" + MsCwVouchersGl.ORDNO + "' where VOUALLNO='" + cfVOUALLNO + "' and BSTABLENAME='ch_fee_invoice' and [STARTGID]='" + strCwSTARTGID + "'" + strLS;
bool bl = T_ALL_DA.GetExecuteSqlCommand(blSQL);
blSQL = "update code_fill_serialno set ISDELETE=1,DELETEUSER='" + strUserID + "',DELETETIME=GETDATE() where TABLENAME='cw_vouchers_gl' and SERIALNO='" + cfVOUALLNO + "' and STARTGID='" + strCwSTARTGID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blSQL);
if (VOUAUTOCHECK == "1")
{
string blSQL2 = "update cw_vouchers_gl set ISCHECKED=1,CHECKED='" + strUserID + "',CHECKEDTIME=getdate() where VOUALLNO='" + cfVOUALLNO + "' and [STARTGID]='" + strCwSTARTGID + "'";
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(blSQL2);
}
}
else
{
//result.Success = false;
//result.Message = result.Message;
//return result;
//删除ch_fee_invoice中未生成的凭证号
//string blSQL = "update ch_fee_invoice set VOUNO='' where VOUNO='" + cfVOUALLNO + "'" + sAndGids.Trim();
//删除凭证生成关系表中的ch_fee_invoice的GID数据
string strLS = sAndGids.Replace("GID", "BSGID");
string blSQL = "delete from [cw_vouno_bs_gl] where VOUALLNO='" + cfVOUALLNO + "' and BSTABLENAME='ch_fee_invoice' and [STARTGID]='" + strCwSTARTGID + "'" + strLS;
bool bl = T_ALL_DA.GetExecuteSqlCommand(blSQL);
return -2;//重复数据
}
#endregion
}
//result.Success = true;
//result.Message = result.Message;
//return result;
return 1;
}
/* 按原币生成凭证*/ /* 按原币生成凭证*/
protected static int getHxtSC(DataSet dsCwDesign, DataSet dsCwDesignItem, string sAndGids, MsCwVouchersGl3 headData, List<MsCwVouchersGl4> bodyList, string strUserID, string strCompanyID, string cfVOUALLNO, string VOUAUTOCHECK) protected static int getHxtSC(DataSet dsCwDesign, DataSet dsCwDesignItem, string sAndGids, MsCwVouchersGl3 headData, List<MsCwVouchersGl4> bodyList, string strUserID, string strCompanyID, string cfVOUALLNO, string VOUAUTOCHECK)
{ {

@ -1678,13 +1678,14 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
string str = ""; string str = "";
var strSql = new StringBuilder(); var strSql = new StringBuilder();
strSql.Append("SELECT "); strSql.Append("SELECT ");
strSql.Append(" VISIBLERANGE,OPERATERANGE "); strSql.Append(" VISIBLERANGE,OPERATERANGE,AUTHORITYID,VSSQL ");
strSql.Append(" from VW_User_Authority "); strSql.Append(" from VW_User_Authority ");
strSql.Append(" where [NAME]='modExchangesUnit' and USERID='" + userid + "' and ISDELETE=0"); strSql.Append(" where [NAME]='modExchangesUnit' and USERID='" + userid + "' and ISDELETE=0");
string visiblerange = "4"; string visiblerange = "4";
string operaterange = "4"; string operaterange = "4";
string AUTHORITYID = "";
string VSSQL = "";
Database db = DatabaseFactory.CreateDatabase(); Database db = DatabaseFactory.CreateDatabase();
@ -1695,6 +1696,8 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
{ {
visiblerange = Convert.ToString(reader["VISIBLERANGE"]); visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
operaterange = Convert.ToString(reader["OPERATERANGE"]); operaterange = Convert.ToString(reader["OPERATERANGE"]);
AUTHORITYID = Convert.ToString(reader["AUTHORITYID"]);
VSSQL = Convert.ToString(reader["VSSQL"]);
break; break;
} }
reader.Close(); reader.Close();
@ -1740,6 +1743,75 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
str = " UPPER(Corpid)='" + companyid + "'"; str = " UPPER(Corpid)='" + companyid + "'";
} }
}
else if (visiblerange == "5")
{
if (tb == "index")
{
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())
{
if (str == "")
{
str = " Corpid='" + Convert.ToString(reader["COMPANYID"]) + "'";
}
else
{
str = str + " or Corpid='" + Convert.ToString(reader["COMPANYID"]) + "'";
};
}
reader.Close();
}
}
else
{
str = " (UPPER(Corpid)='" + companyid + "') ";
}
}
else if (visiblerange == "6")
{
if (tb == "index")
{
var opstr = "";
var userstr = new StringBuilder();
userstr.Append(" select OPID,(select SHOWNAME from [user] where GID=user_authority_range_op.OPID) SHOWNAME from user_authority_range_op where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
Database userdb = DatabaseFactory.CreateDatabase();
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
{
while (reader.Read())
{
if (opstr == "")
{
opstr = " ('" + Convert.ToString(reader["SHOWNAME"]) + "'";
}
else
{
opstr = opstr + ",'" + Convert.ToString(reader["SHOWNAME"]) + "'";
};
}
if (opstr != "") opstr = opstr + ")";
reader.Close();
}
if (opstr == "") opstr = "('" + username + "')";
str = " (OPNAME in " + opstr + " or SALE in " + opstr + " or DOC IN " + opstr + " or OP IN " + opstr + ")";
}
else
{
str = " (UPPER(Corpid)='" + companyid + "') ";
}
} }
else if (visiblerange == "1") else if (visiblerange == "1")
{ {
@ -1749,6 +1821,22 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
{ {
str = "(" + str + ")"; str = "(" + str + ")";
} }
VSSQL = VSSQL.Trim();
if (!string.IsNullOrEmpty(VSSQL))
{
if (!string.IsNullOrEmpty(str))
{
str = str + " and (" + VSSQL + ") ";
}
else
{
str = " (" + VSSQL + ") ";
}
}
return str; return str;
} }
#endregion #endregion

@ -29,6 +29,7 @@ using DSWeb.Areas.MvcShipping.DAL;
using DSWeb.MvcContainer.DAL.MsOpCtnrDAL; using DSWeb.MvcContainer.DAL.MsOpCtnrDAL;
using DSWeb.MvcShipping.Models.MsChFee; using DSWeb.MvcShipping.Models.MsChFee;
using DSWeb.MvcShipping.Models.MsOpAmend; using DSWeb.MvcShipping.Models.MsOpAmend;
using DSWeb.Areas.Account.Models.BSNOLB;
namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
{ {
@ -3136,7 +3137,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
#endregion #endregion
#region 退舱 #region 退舱
public static DBResult CancelShippingOrder ( string bsno,string type,string op,string isdelctn) public static DBResult CancelShippingOrder ( string bsno,string type,string op,string isdelctn,string companyid)
{ {
var result = new DBResult(); var result = new DBResult();
Database db = DatabaseFactory.CreateDatabase(); Database db = DatabaseFactory.CreateDatabase();
@ -3147,7 +3148,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
try try
{ {
var BSNOLIST =new List<BSNOLB>();
if (type == "1") if (type == "1")
{ {
if (isdelctn == "1") if (isdelctn == "1")
@ -3169,6 +3170,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
db.ExecuteNonQuery(cmdDelete, tran); db.ExecuteNonQuery(cmdDelete, tran);
var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=4 where bsno='" + bsno + "'"); var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=4 where bsno='" + bsno + "'");
db.ExecuteNonQuery(cmdUpdateOrder, tran); db.ExecuteNonQuery(cmdUpdateOrder, tran);
var NEWBSNO = new BSNOLB();
NEWBSNO.BSNO = bsno;
BSNOLIST.Add(NEWBSNO);
} }
else { else {
var cmdUpdate = db.GetSqlStringCommand("update op_seae set iscancel='" + type + "' where bsno='" + bsno + "'"); var cmdUpdate = db.GetSqlStringCommand("update op_seae set iscancel='" + type + "' where bsno='" + bsno + "'");
@ -3180,6 +3184,10 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
} }
tran.Commit(); tran.Commit();
if (BSNOLIST!=null&& BSNOLIST.Count!=0)
MsOpSeaeEdiPortDAL.MsOpSeaeEdiPortDAL.SendToDJYDel(BSNOLIST, companyid);
} }
catch (Exception) catch (Exception)
{ {

@ -24,6 +24,7 @@ using Terminal_CDMA;
using DSWeb.MvcShipping.Models.MsOpSeaeEdi; using DSWeb.MvcShipping.Models.MsOpSeaeEdi;
using DSWeb.Areas.Dispatch.Helper; using DSWeb.Areas.Dispatch.Helper;
using DSWeb.MvcShipping.Models.MsOpSeaeDjy; using DSWeb.MvcShipping.Models.MsOpSeaeDjy;
using DSWeb.Areas.Account.Models.BSNOLB;
namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
{ {
@ -9132,7 +9133,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
//{ //{
// Shipping = bill.BLFRT + " Payable at " + str_pay + " " + OpBill.SERVICE + " " + OpBill.PKGS + GetPackageEDICode(OpBill.KINDPKGS, "HANJIN") + " " + formatEdiStr("txt", bill.EDIREMARK) + "'"; // Shipping = bill.BLFRT + " Payable at " + str_pay + " " + OpBill.SERVICE + " " + OpBill.PKGS + GetPackageEDICode(OpBill.KINDPKGS, "HANJIN") + " " + formatEdiStr("txt", bill.EDIREMARK) + "'";
//} //}
Shipping = formatEdiStr("txt", bill.EDIREMARK) + "'"; Shipping = formatEdiStr("txt", bill.EDIREMARK);
Shipping = Shipping.Replace("\n", "\\"); Shipping = Shipping.Replace("\n", "\\");
Shipping = Shipping.Replace("\r", ""); Shipping = Shipping.Replace("\r", "");
string[] DescriptionList2 = Shipping.Split('\\'); string[] DescriptionList2 = Shipping.Split('\\');
@ -25411,7 +25412,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
} }
var Shipping = ""; var Shipping = "";
Shipping = formatEdiStr("txt", bill.SHIPPER); Shipping = bill.SHIPPER;
Shipping = Shipping.Replace("\r\n", "\\"); Shipping = Shipping.Replace("\r\n", "\\");
Shipping = Shipping.Replace("\n", "\\"); Shipping = Shipping.Replace("\n", "\\");
Shipping = Shipping.Replace("\r", " "); Shipping = Shipping.Replace("\r", " ");
@ -25427,7 +25428,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
} }
} }
Shipping = formatEdiStr("txt", bill.CONSIGNEE); Shipping = bill.CONSIGNEE;
Shipping = Shipping.Replace("\r\n", "\\"); Shipping = Shipping.Replace("\r\n", "\\");
Shipping = Shipping.Replace("\n", "\\"); Shipping = Shipping.Replace("\n", "\\");
Shipping = Shipping.Replace("\r", " "); Shipping = Shipping.Replace("\r", " ");
@ -25442,7 +25443,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
error = error + "<br />提单号:" + bill.MBLNO + "收货人中每行字符不能超过32个字符!"; error = error + "<br />提单号:" + bill.MBLNO + "收货人中每行字符不能超过32个字符!";
} }
} }
Shipping = formatEdiStr("txt", bill.NOTIFYPARTY); Shipping = bill.NOTIFYPARTY;
Shipping = Shipping.Replace("\r\n", "\\"); Shipping = Shipping.Replace("\r\n", "\\");
Shipping = Shipping.Replace("\n", "\\"); Shipping = Shipping.Replace("\n", "\\");
Shipping = Shipping.Replace("\r", " "); Shipping = Shipping.Replace("\r", " ");
@ -46775,7 +46776,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
} }
public static DBResult SendToDJYDel(List<MsOpSeae> headData, string companyid) public static DBResult SendToDJYDel(List<BSNOLB> headData, string companyid)
{ {
var result = new DBResult(); var result = new DBResult();
var DJYUPDATE = MsSysParamSetDAL.GetData("PARAMNAME='DJYUPDATE'"); var DJYUPDATE = MsSysParamSetDAL.GetData("PARAMNAME='DJYUPDATE'");
@ -46791,7 +46792,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
var orderlist = new List<string>(); var orderlist = new List<string>();
foreach (var head in headData) foreach (var head in headData)
{ {
if (head.CARRIER == "CMA") //if (head.CARRIER == "CMA")
orderlist.Add(head.BSNO); orderlist.Add(head.BSNO);
} }
if (orderlist.Count > 0) if (orderlist.Count > 0)

@ -426,6 +426,19 @@ namespace DSWeb.MvcShipping.Models.MsCwDesignGl
set { _ISSTLDRCRISGROUP = value; } set { _ISSTLDRCRISGROUP = value; }
} }
private bool _ISINVAMOUNTASSUM = false;
/// <summary>
/// 销项发票根据开票金额生成凭证
/// </summary>
[ModelDB]
public bool ISINVAMOUNTASSUM
{
get { return _ISINVAMOUNTASSUM; }
set { _ISINVAMOUNTASSUM = value; }
}
private bool _ISADVANCE = false; private bool _ISADVANCE = false;
/// <summary> /// <summary>
/// 根据预收预付生成凭证 /// 根据预收预付生成凭证

@ -1315,7 +1315,7 @@ Ext.extend(Shipping.MsChDuiEdit, Ext.Panel, {
_this.girdAddListColumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridAddList', _this.gridAddList.columns, _this.girdAddListColumns, 0, true); _this.girdAddListColumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridAddList', _this.gridAddList.columns, _this.girdAddListColumns, 0, true);
} }
}, { text: Zi.LAN.Save, //初始化 }, { text: Zi.LAN.Initialization, //初始化
handler: function (menu, event) { handler: function (menu, event) {
_this.gridAddList.reconfigure(_this.storeBodyAddList, _this.initgirdAddListColumns); _this.gridAddList.reconfigure(_this.storeBodyAddList, _this.initgirdAddListColumns);
_this.girdAddListColumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridAddList', _this.gridAddList.columns, _this.initgirdAddListColumns, 0, true); _this.girdAddListColumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridAddList', _this.gridAddList.columns, _this.initgirdAddListColumns, 0, true);

@ -208,6 +208,29 @@ Ext.extend(Shipping.FeeViewGrid, Ext.Panel, {
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right', align: 'right',
width: 60 width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: '含税单价',
align: 'right',
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, { }, {
sortable: true, sortable: true,
dataIndex: 'NoTaxAmount', dataIndex: 'NoTaxAmount',
@ -631,6 +654,29 @@ Ext.extend(Shipping.FeeViewGrid, Ext.Panel, {
header: '税率', header: '税率',
align: 'right', align: 'right',
width: 60 width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: '含税单价',
align: 'right',
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, { }, {
sortable: true, sortable: true,
dataIndex: 'NoTaxAmount', dataIndex: 'NoTaxAmount',

@ -743,7 +743,17 @@ Ext.extend(Shipping.MsCwDesignGlIndex, Ext.Panel, {
inputValue: "true", //选中的值 inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值 uncheckedValue: "false", //未选中的值
checked: true //绘制时的选中状态 checked: true //绘制时的选中状态
}] }, {
//fieldLabel: "",
xtype: "checkbox", //checkbox控件
id: "ISINVAMOUNTASSUM",
name: "ISINVAMOUNTASSUM",
boxLabel: "销项发票根据开票金额生成凭证",
width: 210,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true //绘制时的选中状态
}]
}, { xtype: 'hiddenfield', height: 10}]//end items(fieldset 1) }, { xtype: 'hiddenfield', height: 10}]//end items(fieldset 1)
}); });

@ -86,7 +86,10 @@
{name: 'ISARTMSFC', type: 'bool' }, //ISARTMSFC {name: 'ISARTMSFC', type: 'bool' }, //ISARTMSFC
{name: 'ARTMSFC', type: 'string' }, //ARTMSFC {name: 'ARTMSFC', type: 'string' }, //ARTMSFC
{name: 'ISSETTLEMENTSOPEN', type: 'bool' }, //是否在结算自动生成凭证时自动弹出结算凭证 {name: 'ISSETTLEMENTSOPEN', type: 'bool' }, //是否在结算自动生成凭证时自动弹出结算凭证
{name: 'ISSTLEXCHANGERATEISVAR', type: 'bool' }, //是否在结算自动生成凭证时自动弹出结算凭证 { name: 'ISSTLEXCHANGERATEISVAR', type: 'bool' }, //是否在结算自动生成凭证时自动弹出结算凭证
{ name: 'ISSTLDRCRISGROUP', type: 'bool' }, //结算凭证应收应付账款合并
{ name: 'ISINVAMOUNTASSUM', type: 'bool' }, //销项发票根据开票金额生成凭证
{name: 'STARTGID', type: 'string' }, //总账已启用已登录账套GID {name: 'STARTGID', type: 'string' }, //总账已启用已登录账套GID
{name: 'PiaoHao', type: 'string'}, {name: 'PiaoHao', type: 'string'},
{name: 'PiaoHaoRP', type: 'string'}, {name: 'PiaoHaoRP', type: 'string'},

@ -1561,7 +1561,8 @@ Ext.extend(Shipping.MsInfoClientEdit, Ext.Panel, {
}, },
scope: this scope: this
}, { }, {
text: Zi.LAN.btnAdd, //"新建", text: Zi.LAN.btnAdd, //"新建",
id: 'btncustadd',
handler: function (button, event) { handler: function (button, event) {
this.LoadData('add', ''); this.LoadData('add', '');
var basicForm = this.formEdit.getForm(); var basicForm = this.formEdit.getForm();
@ -1806,8 +1807,9 @@ Ext.extend(Shipping.MsInfoClientEdit, Ext.Panel, {
}, },
scope: this scope: this
}); });
var btncustadd = Ext.getCmp('btnESaveAndNew'); var btncustadd = Ext.getCmp('btncustadd');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
Ext.Ajax.request({ Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
@ -1819,8 +1821,36 @@ Ext.extend(Shipping.MsInfoClientEdit, Ext.Panel, {
var result = Ext.JSON.decode(response.responseText); var result = Ext.JSON.decode(response.responseText);
if (result.Success) { if (result.Success) {
btncustadd.hide(); btncustadd.hide();
btnESaveAndNew.hide();
} else { } else {
btncustadd.show(); btncustadd.show();
btnESaveAndNew.show();
}
}
},
scope: this
});
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: 'modInfoClientNoEdit'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success) {
btnESave.hide();
btnESaveAndClose.hide();
btnESaveAndNew.hide();
} else {
btnESave.show();
btnESaveAndClose.show();
btnESaveAndNew.show();
} }
} }
}, },

@ -3661,10 +3661,12 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, {
if (_this.MsPeriod.CLOSEDAY != 0) { if (_this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd'); var myday = Ext.util.Format.date(ETD, 'd');
if (myday > _this.MsPeriod.CLOSEDAY) { if (myday > _this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm'); var lastMonthDate = new Date(ETD); //上月日期
var myyear = Ext.util.Format.date(ETD, 'Y'); lastMonthDate.setDate(1);
mymonth = parseInt(mymonth) + 1; lastMonthDate.setMonth(lastMonthDate.getMonth() + 1);
var mymonthstr = mymonth.toString(); var mymonth = Ext.util.Format.date(lastMonthDate, 'm');
var myyear = Ext.util.Format.date(lastMonthDate, 'Y');
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr; if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr; mydatestr = myyear.toString() + '-' + mymonthstr;
} }
@ -13744,9 +13746,11 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, {
if (this.MsPeriod.CLOSEDAY != 0) { if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(ETD, 'd'); var myday = Ext.util.Format.date(ETD, 'd');
if (myday > this.MsPeriod.CLOSEDAY) { if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(ETD, 'm'); var lastMonthDate = new Date(ETD); //上月日期
var myyear = Ext.util.Format.date(ETD, 'Y'); lastMonthDate.setDate(1);
mymonth = parseInt(mymonth) + 1; lastMonthDate.setMonth(lastMonthDate.getMonth() + 1);
var mymonth = Ext.util.Format.date(lastMonthDate, 'm');
var myyear = Ext.util.Format.date(lastMonthDate, 'Y');
var mymonthstr = mymonth.toString(); var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr; if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr; mydatestr = myyear.toString() + '-' + mymonthstr;

@ -1213,6 +1213,10 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, {
header: Zi.LAN.INSURANCEOP, //'货物标识', header: Zi.LAN.INSURANCEOP, //'货物标识',
width: 70 width: 70
}, { }, {
dataIndex: 'ISSUEDATE',
header: Zi.LAN.ISSUEDATE, //'货物标识',
width: 70
}, {
dataIndex: 'ISCANCEL', dataIndex: 'ISCANCEL',
header: '退舱', //'退舱', header: '退舱', //'退舱',
width: 60, width: 60,

@ -43,18 +43,18 @@ namespace DSWeb.Areas.TruckMng.DAL.MsRptPcHeadEdit
strSql.Append(" select GId,case when TruckNo='' then '接单' else case when isnull(isend,0)=0 then '派车' else '完成' end end PCSTATUSREF "); strSql.Append(" select GId,case when TruckNo='' then '接单' else case when isnull(isend,0)=0 then '派车' else '完成' end end PCSTATUSREF ");
strSql.Append(" ,ROW_NUMBER()over (partition by dbo.trimdate(expdate) order by expdate ) RowNumber "); strSql.Append(" ,ROW_NUMBER()over (partition by dbo.trimdate(expdate) order by expdate ) RowNumber ");
strSql.Append(" ,dbo.trimdate(expdate) GroupDate "); strSql.Append(" ,dbo.trimdate(expdate) GroupDate ");
strSql.Append(" ,BillNo,dbo.trimtime(ExpDate) ExpDate,CustomerName,(select description from info_client where shortname=tMsWlPcHead.CustomerName) CustomerNameFull "); strSql.Append(" ,BillNo,dbo.trimtime(ExpDate) ExpDate,CustomerName,(select description from info_client where shortname=t.CustomerName) CustomerNameFull ");
strSql.Append(" ,F_CustomerName,DstArea,DetiNation "); strSql.Append(" ,F_CustomerName,DstArea,DetiNation ");
strSql.Append(" ,ContainerType,ContainerTypeSe,(SELECT CtnName FROM VMSTRUCKCTN WHERE CTNCODE=ContainerType) AS ContainerType_Ref "); strSql.Append(" ,ContainerType,ContainerTypeSe,(SELECT CtnName FROM VMSTRUCKCTN WHERE CTNCODE=ContainerType) AS ContainerType_Ref ");
strSql.Append(" ,isnull(ContainerQty,0) ContainerQty,TruckNo,MblNo,dbo.trimdate(EndPortDate) EndPortDate,DrvCode,DrvName "); strSql.Append(" ,isnull(ContainerQty,0) ContainerQty,TruckNo,MblNo,dbo.trimdate(EndPortDate) EndPortDate,DrvCode,DrvName ");
strSql.Append(" ,Mobile,YardCode,YARDNAME AS YardCode_Ref "); strSql.Append(" ,Mobile,YardCode,YARDNAME AS YardCode_Ref ");
strSql.Append(" ,RtnYardCode,RtnYardName AS RtnYardCode_Ref "); strSql.Append(" ,RtnYardCode,RtnYardName AS RtnYardCode_Ref ");
strSql.Append(" ,VoyVeg,OrgCode,DDCode,LoadPlace,TruckSpec,FactoryAddr,Remark "); strSql.Append(" ,VoyVeg,OrgCode,DDCode,LoadPlace,TruckSpec,FactoryAddr,Remark ");
strSql.Append(" ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99033 and EnumValueID=(select Property from tmswltruck where truckno=tMsWlPcHead.truckno)) PropertyRef "); strSql.Append(" ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99033 and EnumValueID=(select Property from tmswltruck where truckno=t.truckno)) PropertyRef ");
strSql.Append(" ,RefBillNo,DGTYPE,DGTYPECODE,SECOND_DRV,dbo.trimdate(ArriveDate) ArriveDate,ArriveTime,RefBillNoSe"); strSql.Append(" ,RefBillNo,DGTYPE,DGTYPECODE,SECOND_DRV,dbo.trimdate(ArriveDate) ArriveDate,ArriveTime,RefBillNoSe");
strSql.Append(",dbo.F_GetBillDrFeeStatus(tMsWlPcHead.GId) DRFEESTATUS"); strSql.Append(",dbo.F_GetBillDrFeeStatus(t.GId) DRFEESTATUS");
strSql.Append(",dbo.F_GetBillCrFeeStatus(tMsWlPcHead.GId) CRFEESTATUS"); strSql.Append(",dbo.F_GetBillCrFeeStatus(t.GId) CRFEESTATUS");
strSql.Append(",GOODSCOUNT,CBM,ISHW,Ton,GoodsName,CreateTime,PGId,ContainerNo,SealNo,ContainerNoSe,SealNoSe "); strSql.Append(",GOODSCOUNT,CBM,ISHW,Ton,GoodsName,CreateTime,PGId,ContainerNo,SealNo,ContainerNoSe,SealNoSe ");
strSql.Append(" from tMsWlPcHead t "); strSql.Append(" from tMsWlPcHead t ");
if (!string.IsNullOrEmpty(strCondition)) if (!string.IsNullOrEmpty(strCondition))

Loading…
Cancel
Save