Example #1
0
include_once "../../DataAccessObjects/ContractItemDAO.php";
include_once "../../DataTransferObjects/ContractItemDTO.php";
if (!isset($_REQUEST["acao"])) {
    echo "Erro no processamento da requisição.";
    exit;
}
$acao = $_REQUEST["acao"];
// Abre a conexao com o banco de dados
$dataConnector = new DataConnector('both');
$dataConnector->OpenConnection();
if ($dataConnector->mysqlConnection == null || $dataConnector->sqlserverConnection == null) {
    echo 'Não foi possível se connectar ao bando de dados!';
    exit;
}
// Cria os objetos de mapeamento objeto-relacional
$invoiceDAO = new InvoiceDAO($dataConnector->sqlserverConnection);
$invoiceDAO->showErrors = 1;
$billingDAO = new BillingDAO($dataConnector->mysqlConnection);
$billingDAO->showErrors = 1;
$mailingDAO = new MailingDAO($dataConnector->mysqlConnection);
$mailingDAO->showErrors = 1;
$billingItemDAO = new BillingItemDAO($dataConnector->mysqlConnection);
$billingItemDAO->showErrors = 1;
$contractItemDAO = new ContractItemDAO($dataConnector->mysqlConnection);
$contractItemDAO->showErrors = 1;
if ($acao == "store") {
    $mailing_id = $_REQUEST["mailingId"];
    $startDate = $_REQUEST["dataInicial"];
    $endDate = $_REQUEST["dataFinal"];
    $mailing = $mailingDAO->RetrieveRecord($mailing_id);
    $billingParams = 'businessPartnerCode=' . $mailing->businessPartnerCode . '&contractId=' . $mailing->contrato_id . '&subContractId=' . $mailing->subContrato_id . '&startDate=' . $startDate . '&endDate=' . $endDate . '&acrescimo=&obs=';
 /**
  * @return OrderItem[]
  */
 public function getOrderItems()
 {
     if (!isset($this->orderItems)) {
         $this->orderItems = array();
         foreach (InvoiceDAO::getInstance()->getInvoiceItems($this->id) as $invoiceItem) {
             if ($orderItem = OrderItemDAO::getInstance()->getOrderItem($invoiceItem['order_item_id'])) {
                 $this->orderItems[] = $orderItem;
             }
         }
     }
     return $this->orderItems;
 }
Example #3
0
$endDate = $_GET['endDate'];
$salesPerson = $_GET['salesPerson'];
$searchMethod = $_GET['searchMethod'];
$sendToPrinter = null;
if (isset($_GET['sendToPrinter'])) {
    $sendToPrinter = $_GET['sendToPrinter'];
}
// Abre a conexao com o banco de dados
$dataConnector = new DataConnector('both');
$dataConnector->OpenConnection();
if ($dataConnector->mysqlConnection == null || $dataConnector->sqlserverConnection == null) {
    echo 'Não foi possível se connectar ao bando de dados!';
    exit;
}
// Cria os objetos de mapeamento objeto-relacional
$invoiceDAO = new InvoiceDAO($dataConnector->sqlserverConnection);
$invoiceDAO->showErrors = 1;
$billingItemDAO = new BillingItemDAO($dataConnector->mysqlConnection);
$billingItemDAO->showErrors = 1;
$equipmentDAO = new EquipmentDAO($dataConnector->sqlserverConnection);
$equipmentDAO->showErrors = 1;
$equipmentModelDAO = new EquipmentModelDAO($dataConnector->mysqlConnection);
$equipmentModelDAO->showErrors = 1;
$salesPersonDAO = new SalesPersonDAO($dataConnector->sqlserverConnection);
$salesPersonDAO->showErrors = 1;
// Busca as notas canceladas no período
$returnedInvoiceArray = $invoiceDAO->RetrieveReturnedInvoices("(T0.DocDate BETWEEN '" . $startDate . "' AND '" . $endDate . "' OR T3.DocDate BETWEEN '" . $startDate . "' AND '" . $endDate . "') AND T3.DocTotal > 0");
$returnedInvoiceList = "";
foreach ($returnedInvoiceArray as $returnedInvoice) {
    if (!empty($returnedInvoiceList)) {
        $returnedInvoiceList .= ", ";
Example #4
0
    exit;
}
include_once "../defines.php";
include_once "../ClassLibrary/DataConnector.php";
include_once "../DataAccessObjects/InvoiceDAO.php";
include_once "../DataTransferObjects/InvoiceDTO.php";
include_once "../DataTransferObjects/InvoiceItemDTO.php";
// Abre a conexao com o banco de dados
$dataConnector = new DataConnector('sqlServer');
$dataConnector->OpenConnection();
if ($dataConnector->sqlserverConnection == null) {
    echo 'Não foi possível se connectar ao bando de dados!';
    exit;
}
// Cria o objeto de mapeamento objeto-relacional
$invoiceDAO = new InvoiceDAO($dataConnector->sqlserverConnection);
$invoiceDAO->showErrors = 1;
$invoice = $invoiceDAO->RetrieveRecord($invoiceNum);
if ($invoice == null) {
    echo '<h3>Erro ao localizar nota fiscal.</h3>';
    exit;
}
$invoiceItems = "";
$itemArray = $invoiceDAO->RetrieveInvoiceItems($invoice->docNum);
foreach ($itemArray as $item) {
    $description = $item->description . '(' . $item->itemCode . ')';
    $quantity = number_format($item->quantity, 0, '', '');
    $lineTotal = number_format($item->lineTotal, 2, ',', '.');
    $usage = $item->usage;
    if (!empty($invoiceItems)) {
        $invoiceItems = $invoiceItems . "<br/>";