|
|
@@ -45,6 +45,7 @@ type ErmcpSpotContractModel struct {
|
|
|
EnumdicName string `json:"enumdicname" xorm:"'ENUMDICNAME'"` //单位名称
|
|
|
CONTRACCTSTATUS int32 `json:"contracctstatus" xorm:"'CONTRACTSTATUS'"` //合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
|
|
|
Remark string `json:"remark" xorm:"'Remark'"` //备注
|
|
|
+ AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` //审核时间
|
|
|
}
|
|
|
|
|
|
func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
|
@@ -71,6 +72,7 @@ func (r *ErmcpSpotContractModel) buildSql(nQueryType int32) string {
|
|
|
" t.MARGIN," +
|
|
|
" t.remark," +
|
|
|
" t.contractstatus," +
|
|
|
+ " to_char(t.audittime,'yyyy-mm-dd hh24:mi:ss') audittime," +
|
|
|
" u1.accountname BuyUserName," +
|
|
|
" u2.accountname SellUserName," +
|
|
|
" g.deliverygoodscode," +
|
|
|
@@ -122,7 +124,6 @@ func (r *ErmcpSpotContractModel) GetData(nQueryType int32) ([]ErmcpSpotContractM
|
|
|
type ErmcpModel struct {
|
|
|
UserID int64 `json:"userid" xorm:"'UserID'"` // 用户ID
|
|
|
SpotContractId string `json:"spotcontractid" xorm:"'SPOTCONTRACTID'"` // 合同ID
|
|
|
- AccountId string `json:"accountid" xorm:"'ACCOUNTID'"` // 账户ID
|
|
|
AccountName string `json:"accountname" xorm:"'ACCOUNTNAME'"` // 账户名称
|
|
|
DeliveryGoodsId int `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货商品ID
|
|
|
DeliveryGoodsCode string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 现货商品代码
|
|
|
@@ -161,8 +162,9 @@ type ErmcpModel struct {
|
|
|
Contractno string `json:"contractno" xorm:"'Contractno'"` // 合同编号
|
|
|
TotalAmount float64 `json:"totalamount" xorm:"'-'"` // 合计总额
|
|
|
ReckonedAmount float64 `json:"reckonedamount" xorm:"'ReckonedAmount'"` // 已收付额(已确定额)
|
|
|
- BUYUSERID int64 `json:"-" xorm:"'BUYUSERID'"` //采购方ID
|
|
|
- SELLUSERID int64 `json:"-" xorm:"'SELLUSERID'"` //销售方ID
|
|
|
+ BUYUSERID int64 `json:"-" xorm:"'BUYUSERID'"` // 采购方ID
|
|
|
+ SELLUSERID int64 `json:"-" xorm:"'SELLUSERID'"` // 销售方ID
|
|
|
+ AUDITTIME string `json:"audittime" xorm:"'AUDITTIME'"` // 审核时间
|
|
|
}
|
|
|
|
|
|
func (r *ErmcpModel) calc() {
|
|
|
@@ -212,8 +214,7 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
|
|
|
" t.contracttype," +
|
|
|
" t.remark," +
|
|
|
" t.margin," +
|
|
|
- " to_char(ta.accountid) accountid," +
|
|
|
- " ta.accountname," +
|
|
|
+ " u.accountname," +
|
|
|
" g.deliverygoodscode," +
|
|
|
" g.deliverygoodsname," +
|
|
|
" g2.goodscode," +
|
|
|
@@ -226,10 +227,11 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
|
|
|
" t.ReckonAdjustAmount," +
|
|
|
" t.Price," +
|
|
|
" t.ReckonedAmount," +
|
|
|
+ " to_char(t.audittime,'yyyy-mm-dd hh24:mi:ss') audittime," +
|
|
|
" t.pricedamount + t.ReckonAdjustAmount as LoanAmount" +
|
|
|
" from ermcp_spotcontract t" +
|
|
|
- " left join taaccount ta" +
|
|
|
- " on t.%v = ta.userid" +
|
|
|
+ " left join useraccount u" +
|
|
|
+ " on t.%v = u.userid" +
|
|
|
" left join deliverygoods g" +
|
|
|
" on t.deliverygoodsid = g.deliverygoodsid" +
|
|
|
" left join goods g2" +
|
|
|
@@ -250,8 +252,8 @@ func (r *ErmcpModel) buildSql(nContractType, nQueryType int32) string {
|
|
|
} else if 2 == nQueryType {
|
|
|
// 待点价
|
|
|
status = "2"
|
|
|
- str = str + " and t.qty - t.pricedqty > 0 " +
|
|
|
- "order by unpricedqty, t.audittime desc"
|
|
|
+ str = str + " and t.qty - t.pricedqty > 0 and t.pricetype !=1 " +
|
|
|
+ "order by unpricedqty desc, t.audittime desc"
|
|
|
} else {
|
|
|
// 履约
|
|
|
status = "2"
|