Hi I'm Using the Dashboard Here i want to export the Table into excel here is the code
namespace demo\sales; use \koolreport\dashboard\widgets\Table; use \koolreport\dashboard\fields\Text; use \koolreport\dashboard\fields\Currency;
use \demo\AutoMaker;
class Result extends Table {
protected function onInit() {
$this->pageSize(10);
$this->showFooter(true);
}
protected function dataSource() {
$Order_Status = $this->sibling('OrderStats')->value();
$DateRangePickerDemo = $this->sibling('DateRangePickers')->value();
return AutoMaker::table("orders")
->where("Order_Status", $Order_Status)
->whereBetween("Invoice_Date", $DateRangePickerDemo)
->select('Order_Number')
->select('Order_Status')
->select('Invoice_Date')
->select('Invoice_Number')
->select('Student_Name')
->select('Account_No')
->select('Order_Status')
->select('Payment_Type')
->select('Razorpay_Payment_id')
->select("`CGST(0%)`")
->select("`SGST(0%)`")
->select("`CGST(5%)`")
->select("`SGST(5%)`")
->select("`CGST(12%)`")
->select("`SGST(12%)`")
->select("`CGST(18%)`")
->select("`SGST(18%)`")
->select("`IGST(0%)`")
->select("`IGST(5%)`")
->select("`IGST(12%)`")
->select("`IGST(18%)`")
->select("`Shipping_total`")
->select("`Shipping_Rate`")
->select("`Shipping_CGST`")
->select("`Shipping_SGST`")
->select("`Shipping_IGST`")
->select("`Sub_Total`")
->select("`Tax_Amount`")
->select("`Invoice_Amount`")
;
protected function fields() {
return [
Text::create("Order_Number"),
Text::create("Order_Status"),
Text::create("Invoice_Date"),
Text::create("Invoice_Number"),
Text::create("Student_Name"),
Text::create("Account_No"),
Text::create("Order_Status"),
Text::create("Payment_Type"),
Text::create("Razorpay_Payment_id"),
Text::create("CGST(0%)"),
Text::create("CGST(0%)"),
Text::create("SGST(0%)"),
Text::create("CGST(5%)"),
Text::create("SGST(5%)"),
Text::create("CGST(12%)"),
Text::create("SGST(12%)"),
Text::create("SGST(18%)"),
Text::create("SGST(18%)"),
Text::create("IGST(0%)"),
Text::create("IGST(5%)"),
Text::create("IGST(12%)"),
Text::create("IGST(18%)"),
->footerText("<b>Total</b>"),
Currency::create("Shipping_Rate")
->INR()
->symbol()
->decimals(0)
->footer("sum"),
Currency::create("Shipping_CGST")
->INR()
->symbol()
->decimals(0)
->footer("sum"),
Currency::create("Shipping_SGST")
->INR()
->symbol()
->decimals(0)
->footer("sum"),
Currency::create("Shipping_IGST")
->INR()
->symbol()
->decimals(0)
->footer("sum"),
Currency::create("Tax_Amount")
->INR()
->symbol()
->decimals(0)
->footer("sum"),
Currency::create("Sub_Total")
->USD()
->symbol()
->decimals(0)
->footer("sum"),
Currency::create("Invoice_Amount")
->INR()
->symbol()
->decimals(0)
->footer("sum"),
];
}
}