total,_:=e.Table("propertytab").Join("INNER","contracttab","propertytab.contractid=contracttab.contractid and propertytab.cid=contracttab.cid").Where("propertytab.buildingid = ? and contracttab.enddate >? and propertytab.cid = ?",v.Buildingid,startdate,t.Cid).Count(p)
total,_:=e.Table("propertytab").Join("INNER","contracttab","propertytab.contractid=contracttab.contractid and propertytab.cid=contracttab.cid").Where("propertytab.buildingid = ? and contracttab.enddate >? and propertytab.cid = ?",v.Buildingid,startdate,t.Cid).Count(p)
//计算每栋楼的房间数
alltotal,_:=e.Table("propertytab").Where("isfree != '3' and propertytab.buildingid = ? and propertytab.cid = ?",v.Buildingid,t.Cid).Count(p)
alltotal,_:=e.Table("propertytab").Where("isfree != '3' and propertytab.buildingid = ? and propertytab.cid = ?",v.Buildingid,t.Cid).Count(p)
_,err:=e.Table("chargeallocationtab").Select("sum(allocateexpense) as paid_in_money").Where("allocateyear =? and allocatemonth >=? and cid = ?",i,settledate,t.Cid).Or("allocateyear =? and allocatemonth <=? and cid = ?",endtime,settledate,t.Cid).Get(ss)
_,err:=e.Table("chargeallocationtab").Select("sum(allocateexpense) as paid_in_money").Where("allocateyear =? and allocatemonth >=? and cid = ?",i,settledate,t.Cid).Or("allocateyear =? and allocatemonth <=? and cid = ?",endtime,settledate,t.Cid).Get(ss)
_,err=e.Table("propertytab").Select("propertytypetab.unitprice as unitprice,(SELECT SUM(constructionarea) FROM propertytab WHERE isfree != '3') as constructionarea").Join("INNER","buildingtab","propertytab.buildingid=buildingtab.buildingid and propertytab.cid=buildingtab.cid").Join("INNER","propertytypetab","propertytypetab.propertytypeid=buildingtab.propertytypeid and propertytypetab.cid=buildingtab.cid").Where("propertytab.cid = ?",t.Cid).Get(buildInfo)
_,err=e.Table("propertytab").Select("propertytypetab.unitprice as unitprice,(SELECT SUM(constructionarea) FROM propertytab WHERE isfree != '3') as constructionarea").Join("INNER","buildingtab","propertytab.buildingid=buildingtab.buildingid and propertytab.cid=buildingtab.cid").Join("INNER","propertytypetab","propertytypetab.propertytypeid=buildingtab.propertytypeid and propertytypetab.cid=buildingtab.cid").Where("propertytab.cid = ?",t.Cid).Get(buildInfo)
count,err:=engine.Table(t.TableName()).Where("chargetime >= ? and chargetime <= ? and cid = ? and chargetype = ?",start,end,cid,chargeType).Sum(t,"chargableexpense")