Browse Source

export commandes à la Maddie, orienté numéro commande

master
artnuc.ct9 4 years ago
parent
commit
b80fe490dc
  1. 25
      src/controller/Distribution.hx

25
src/controller/Distribution.hx

@ -87,6 +87,17 @@ class Distribution extends Controller
} }
function getUser(uid:Int):db.User {
return db.User.manager.get(uid, false);
}
function getBasket(userId, placeId, date){
var user = getUser(userId);
var place = db.Place.manager.get(placeId, false);
return db.Basket.getOrCreate(user, place, date);
}
/** /**
* Attendance sheet to print ( mutidistrib ) * Attendance sheet to print ( mutidistrib )
*/ */
@ -174,18 +185,24 @@ class Distribution extends Controller
var data = new Array<Dynamic>(); var data = new Array<Dynamic>();
for (o in orders3) { for (o in orders3) {
var basket = getBasket(o.userId,view.place.id,view.date);
data.push( { data.push( {
"name":o.userName,
"productName":o.productName,
"NUM": basket.num,
"ADHERENT":o.userName,
"PRODUIT":o.productName,
"QTÉ":o.quantity,
"price":view.formatNum(o.productPrice), "price":view.formatNum(o.productPrice),
"quantity":o.quantity,
"fees":view.formatNum(o.fees), "fees":view.formatNum(o.fees),
"total":view.formatNum(o.total), "total":view.formatNum(o.total),
"paid":o.paid "paid":o.paid
}); });
} }
sugoi.tools.Csv.printCsvDataFromObjects(data, ["name", "productName", "price", "quantity","fees","total", "paid"],"Export-commandes-"+date.toString().substr(0,10)+"-Cagette");
sugoi.tools.Csv.printCsvDataFromObjects(data, ["NUM","ADHERENT", "PRODUIT", "QTÉ","price","fees","total","paid"],"Export-commandes-"+date.toString().substr(0,10)+"-Cagette");
//sugoi.tools.Csv.printCsvDataFromObjects(data, ["NUM","ADHERENT", "PRODUIT", "price", "quantity","fees","total", "paid"],"Export-commandes-"+date.toString().substr(0,10)+"-Cagette");
return; return;
} }
} }

Loading…
Cancel
Save