public salepurchasedetails(int transid, string type) // type is sale or purchase { InitializeComponent(); var productsalepurchaserepo = new data.dapper.productsalepurchaserepo(); transactionid = transid; var productsinsale = productsalepurchaserepo.getmultiplebytransactionid(transactionid); foreach (var item in productsinsale) { dg.Items.Add(item); } if (type == "sale") { print_btn.IsEnabled = true; } }
public static void prepareinvoicereport(int saleid) { var financetransactionrepo = new data.dapper.financetransactionrepo(); financetransactionextended saletransaction = financetransactionrepo.get(saleid); if (saletransaction != null) { List <KeyValuePair <string, string> > parms = new List <KeyValuePair <string, string> >(); KeyValuePair <string, string> saleidkeyvalue = new KeyValuePair <string, string>("saleid", saleid.ToString()); KeyValuePair <string, string> customernamekeyvalue = new KeyValuePair <string, string>("customername", (saletransaction.target != null)? saletransaction.target:""); parms.Add(saleidkeyvalue); parms.Add(customernamekeyvalue); var productsalepurchaserepo = new data.dapper.productsalepurchaserepo(); var productsinsale = productsalepurchaserepo.getmultiplebytransactionid(saleid); DataTable dt = ToDataTable <productsalepurchaseextended>(productsinsale); List <KeyValuePair <string, DataTable> > dss = new List <KeyValuePair <string, DataTable> >(); KeyValuePair <string, DataTable> productsds = new KeyValuePair <string, DataTable>("products", dt); dss.Add(productsds); new reportviewer("data/reporttemplates/invoice.rdl", parms, dss).Show(); } }