where += " and make_date ='" + args["make_date"] + "'"
}
if args["enterprise_name"] != "" {
var enterprise []model.Enterprise
eg.Where("name like ?", "%"+args["enterprise_name"]+"%").Find(&enterprise)
oids := []string{"-1"}
for _, v := range enterprise {
oids = append(oids, utils.IntToStr(v.Id))
}
where += " and enterprise_id in(" + php2go.Implode(",", oids) + ")"
}
if args["inside_name"] != "" {
var enterprise []model.Enterprise
eg.Where("inside_name like ?", "%"+args["inside_name"]+"%").Find(&enterprise)
oids := []string{"-1"}
for _, v := range enterprise {
oids = append(oids, utils.IntToStr(v.Id))
}
where += " and enterprise_id in(" + php2go.Implode(",", oids) + ")"
}
sql := "select SUM(IF(state!=5,amount,0)) as amount,SUM(IF(state!=5,1,0)) as alls,SUM(IF(state=0,1,0)) as wait_do,SUM(IF(state=1,1,0)) as dos,SUM(IF(state=2,1,0)) as baking,SUM(IF(state=3,1,0)) as sorting,SUM(IF(state=4,1,0)) as success,SUM(IF(state=5,1,0)) as cancel from `order` where %s"
sql := "select SUM(IF(state!=5,amount,0)) as amount,SUM(IF(state!=5,1,0)) as alls,SUM(IF(state=0,1,0)) as wait_do,SUM(IF(state=1,1,0)) as dos,SUM(IF(state=2,1,0)) as baking,SUM(IF(state=3,1,0)) as sorting,SUM(IF(state=4,1,0)) as success,SUM(IF(state=5,1,0)) as cancel from `order` where %s"
where += " and o.make_date ='" + param["make_date"] + "'"
}
if param["enterprise_name"] != "" {
var enterprise []model.Enterprise
eg.Where("name like ?", "%"+param["enterprise_name"]+"%").Find(&enterprise)
oids := []string{"-1"}
for _, v := range enterprise {
oids = append(oids, utils.IntToStr(v.Id))
}
where += " and o.enterprise_id in(" + php2go.Implode(",", oids) + ")"
}
if param["inside_name"] != "" {
var enterprise []model.Enterprise
eg.Where("inside_name like ?", "%"+param["inside_name"]+"%").Find(&enterprise)
oids := []string{"-1"}
for _, v := range enterprise {
oids = append(oids, utils.IntToStr(v.Id))
}
where += " and o.enterprise_id in(" + php2go.Implode(",", oids) + ")"
}
sql := "select SUM(IF(state!=5,num*price,0)) as amount,SUM(IF(state!=5,num,0)) as alls,SUM(IF(state=0,num,0)) as wait_do,SUM(IF(state=1,num,0)) as dos,SUM(IF(state=2,num,0)) as baking,SUM(IF(state=3,num,0)) as sorting,SUM(IF(state=4,num,0)) as success,SUM(IF(state=5,num,0)) as cancel from `order_goods` left join `order` o on o.oid=og.oid where %s"