Example #1
0
 public function __construct()
 {
     // Defino Vendedor
     $this->issuer = new Issuer();
     $this->issuer->setCompanyDocument('47.377.613/0001-06');
     $this->issuer->setCompanyName('DIN DIGITAL WEB LTDA ME');
     $this->issuer->setTradingName('DIN DIGITAL');
     $this->issuer->setStateRegistration('123.456.789-10');
     // Defino Endereço do Vendedor
     $issuerAddress = new Address();
     $issuerAddress->setStreet('Rua Bernardino de Campos');
     $issuerAddress->setNumber('31, Sala 501');
     $issuerAddress->setNeighborhood('Centro');
     $issuerAddress->setCity('Santo André');
     $issuerAddress->setState('SP');
     $issuerAddress->setZipCode('09015-010');
     // Adiciono endereço do vendedor ao vendedor
     $this->issuer->setAddress($issuerAddress);
     // Defino Cliente
     $this->receiver = new Receiver();
     $this->receiver->setDocument('446.441.646-23');
     $this->receiver->setName('NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL');
     $this->receiver->setEmail('*****@*****.**');
     // Defino Endereço do Vendedor
     $receiverAddress = new Address();
     $receiverAddress->setStreet('Rua Havana');
     $receiverAddress->setNumber('217');
     $receiverAddress->setNeighborhood('Parque das Américas');
     $receiverAddress->setCity('Mauá');
     $receiverAddress->setState('SP');
     $receiverAddress->setZipCode('09351-020');
     // Adiciono endereço do vendedor ao vendedor
     $this->receiver->setAddress($receiverAddress);
     // Crio um Produto
     $product1 = new Item();
     $product1->setDescription('Produto 1');
     $product1->setQuantity('1');
     $product1->setCost('300');
     $product1->setNcmCode('33030020');
     // Crio outro Produto
     $product2 = new Item();
     $product2->setDescription('Produto 2');
     $product2->setQuantity('2');
     $product2->setCost('125.50');
     $product2->setNcmCode('33030020');
     $this->items = new ItemContainer($this->receiver);
     $this->items->addItem($product1);
     $this->items->addItem($product2);
 }
Example #2
0
    $receiver->setDocument('446.441.646-23');
    $receiver->setName('NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL');
    $receiver->setEmail('*****@*****.**');
    $receiverAddress = new Address();
    $receiverAddress->setStreet('Rua Bernardino de Campos');
    $receiverAddress->setNumber('31, Sala 501');
    $receiverAddress->setNeighborhood('Centro');
    $receiverAddress->setCity('Santo André');
    $receiverAddress->setState('SP');
    $receiverAddress->setZipCode('09015-010');
    $receiver->setAddress($receiverAddress);
    $product1 = new Item();
    $product1->setDescription('Produto 1');
    $product1->setQuantity('1');
    $product1->setCost('300');
    $product1->setNcmCode('33030020');
    $items = new ItemContainer($receiver);
    $items->addItem($product1);
    $nfse = new Nfse(new DateTime("2015-03-23 12:00:00"), $issuer, $receiver, $items);
} catch (\NfeFocus\Exception\FieldRequiredException $e) {
    die($e->getMessage());
} catch (Exception $e) {
    die($e->getMessage());
}
$reference = uniqid();
echo "Referencia: {$reference}<br/>";
$transaction = new InsertTransaction(Enviroment::DEVELOPMENT, TOKEN);
if ($transaction->insert($nfse, $reference)) {
    echo "OK";
    // Persistir a referencia utilizada para emissão da nota fiscal
} else {