Exemplo n.º 1
0
 /**
  * Generate pdf invoice
  * @access public
  */
 public function indexAction()
 {
     $id = $this->Request()->id;
     $netto = $this->Request()->ust_free;
     if ($netto == "false") {
         $netto = false;
     }
     $typ = $this->Request()->typ;
     $voucher = $this->Request()->voucher;
     $date = $this->Request()->date;
     $delivery_date = $this->Request()->delivery_date;
     $bid = $this->Request()->bid;
     $this->View()->setTemplate();
     $document = Shopware_Components_Document::initDocument($id, $typ, array("netto" => $netto, "bid" => $bid, "voucher" => $voucher, "date" => $date, "delivery_date" => $delivery_date, "shippingCostsAsPosition" => true, "_renderer" => "pdf", "_preview" => $this->Request()->preview, "_previewForcePagebreak" => $this->Request()->pagebreak, "_previewSample" => $this->Request()->sampleData, "docComment" => utf8_decode($this->Request()->docComment), "forceTaxCheck" => $this->Request()->forceTaxCheck));
     $document->render();
 }
Exemplo n.º 2
0
 /**
  * Internal helper function which is used from the batch function and the createDocumentAction.
  * The batch function fired from the batch window to create multiple documents for many orders.
  * The createDocumentAction fired from the detail page when the user clicks the "create Document button"
  * @param $orderId
  * @param $documentType
  * @return bool
  */
 private function createDocument($orderId, $documentType)
 {
     $renderer = "pdf";
     // html / pdf
     $deliveryDate = $this->Request()->getParam('deliveryDate', null);
     if (!empty($deliveryDate)) {
         $deliveryDate = new \DateTime($deliveryDate);
         $deliveryDate = $deliveryDate->format('d.m.Y');
     }
     $displayDate = $this->Request()->getParam('displayDate', null);
     if (!empty($displayDate)) {
         $displayDate = new \DateTime($displayDate);
         $displayDate = $displayDate->format('d.m.Y');
     }
     $document = Shopware_Components_Document::initDocument($orderId, $documentType, array('netto' => (bool) $this->Request()->getParam('taxFree', false), 'bid' => $this->Request()->getParam('invoiceNumber', null), 'voucher' => $this->Request()->getParam('voucher', null), 'date' => $displayDate, 'delivery_date' => $deliveryDate, 'shippingCostsAsPosition' => (int) $documentType !== 2, '_renderer' => $renderer, '_preview' => $this->Request()->getParam('preview', false), '_previewForcePagebreak' => $this->Request()->getParam('pageBreak', null), '_previewSample' => $this->Request()->getParam('sampleData', null), 'docComment' => $this->Request()->getParam('docComment', null), 'forceTaxCheck' => $this->Request()->getParam('forceTaxCheck', false)));
     $document->render();
     if ($renderer == "html") {
         exit;
     }
     // Debu//g-Mode
     return true;
 }
Exemplo n.º 3
0
 /**
  * Creates Cancel invoice
  *
  * @return  String  $ordernumber   Ordernumber
  * @params  String  $amount        new amount
  */
  private function _createCancelInvoice($orderNumber, $amount)
 {
     $orderID =$this->_getOrderIdByNumber($orderNumber);
     $dispatch = $this->_getDispatchId($orderNumber);
     $shippingflag = $dispatch > 0?  true: false;
     $sql = "SELECT * FROM s_order_documents WHERE orderID = ? AND type= ?";
     $getDocument = Shopware()->Db()->fetchRow($sql, array((int)$orderID, (int)3));
     $sql = "SELECT docID FROM s_order_documents WHERE orderID = ? AND type= ?";
     $bid = Shopware()->Db()->fetchOne($sql, array((int)$orderID, (int)3));
     if(!$getDocument){
         $document = Shopware_Components_Document::initDocument($orderID, 3, array(
             "netto" => false,
             "date" => date("Y-m-d H:i:s"),
             "shippingCostsAsPosition" => $shippingflag,
             "bid"=>$bid,
             "_renderer" => "pdf"
         ));
         $document->render();
         $sql = "SELECT * FROM s_order_documents WHERE orderID = ? AND type= ?";
         $getDocument = Shopware()->Db()->fetchRow($sql, array((int)$orderID, (int)3));
         $sql = "INSERT INTO `pi_ratepay_bills`(`order_id`, `order_number`, `invoice_amount`, `invoice_hash`, `type`)
                 VALUES(?, ?, ?, ?, ?)	";
         Shopware()->Db()->query($sql, array($orderID, $orderNumber, (double)$amount, $getDocument['hash'],(int)3));
     }
     else{
         $sql = "UPDATE pi_ratepay_bills SET invoice_hash = ? WHERE order_number = ? AND type = ?";
         Shopware()->Db()->query($sql, array($getDocument['hash'], $orderNumber,(int)3));
     }
 }