Esempio n. 1
0
 public function genReport($sender, $param)
 {
     $results = $errors = array();
     try {
         Dao::beginTransaction();
         if (isset($param->CallbackParameter->type) && ($type = trim($param->CallbackParameter->type)) === '') {
             throw new Exception('SYSTEM ERROR: invalid type passed in.');
         }
         $asset = null;
         switch (strtolower($type)) {
             case 'sales_daily':
                 SalesExport_Xero::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = SalesExport_Xero::run(false, false);
                 break;
             case 'creditnotes_daily':
                 CreditNoteExport_Xero::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = CreditNoteExport_Xero::run(false, false);
                 break;
             case 'supplier_bill_daily':
                 BillExport_Xero::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = BillExport_Xero::run(false, false);
                 break;
             case 'manual_journal':
                 ManualJournalExport_Xero::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = ManualJournalExport_Xero::run(false, false);
                 break;
             case 'payments_daily':
                 PaymentExport_Xero::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = PaymentExport_Xero::run(false, false);
                 break;
             case 'inventory_list':
                 ItemExport_Xero::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = ItemExport_Xero::run(false, true);
                 break;
             case 'magento_price':
                 ItemExport_Magento::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = ItemExport_Magento::run(false, false);
                 break;
             case 'accounting_code':
                 AccoutingCodeExport::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = AccoutingCodeExport::run(false, false);
                 break;
             case 'open_inv':
                 OpenInvoiceExport::setStartNEndDate(new UDate(trim($param->CallbackParameter->date_from)), new UDate(trim($param->CallbackParameter->date_to)));
                 $asset = OpenInvoiceExport::run(false, false);
                 break;
             default:
                 throw new Exception('SYSTEM ERROR: invalid type passed in: ' . $type);
         }
         if ($asset instanceof Asset) {
             $results['item'] = $asset->getJson();
         }
         Dao::commitTransaction();
     } catch (Exception $ex) {
         Dao::rollbackTransaction();
         $error[] = $ex->getMessage();
     }
     $param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
 }
Esempio n. 2
0
<?php

require_once dirname(__FILE__) . '/class/ExportAbstract.php';
Core::setUser(UserAccount::get(UserAccount::ID_SYSTEM_ACCOUNT));
// //run sales export for xero
require_once dirname(__FILE__) . '/class/SalesExport_Xero.php';
SalesExport_Xero::run(true);
// //run creditnote for xero
require_once dirname(__FILE__) . '/class/CreditNoteExport_Xero.php';
CreditNoteExport_Xero::run(true);
//run bill export for xero
require_once dirname(__FILE__) . '/class/BillExport_Xero.php';
BillExport_Xero::run(true);
//run item list export for xero
// require_once dirname(__FILE__) . '/class/ItemExport_Xero.php';
// ItemExport_Xero::run(true);
//run ManualJournalExport_Xero export for xero
require_once dirname(__FILE__) . '/class/ManualJournalExport_Xero.php';
ManualJournalExport_Xero::run(true);
//run item list export for xero
require_once dirname(__FILE__) . '/class/ItemExport_Magento.php';
ItemExport_Magento::run(true);
require_once dirname(__FILE__) . '/class/PaymentExport_Xero.php';
PaymentExport_Xero::run(true);