コード例 #1
0
ファイル: Nfse.php プロジェクト: dindigital/nfe-focus
 public function __construct(DateTime $datetime, Issuer $issuer, Receiver $receiver, Items\ItemContainer $items, Duplicatas\DuplicatasContainer $duplicatas = null)
 {
     $this->_nfse = array("natureza_operacao" => 'Remessa de Produtos', "forma_pagamento" => 0, "data_emissao" => $datetime->format(DateTime::ATOM), "tipo_documento" => 1, "finalidade_emissao" => 1, "cnpj_emitente" => $issuer->getCompanyDocument(), "nome_emitente" => $issuer->getCompanyName(), "nome_fantasia_emitente" => $issuer->getTradingName(), "logradouro_emitente" => $issuer->getAddress()->getStreet(), "numero_emitente" => $issuer->getAddress()->getNumber(), "bairro_emitente" => $issuer->getAddress()->getNeighborhood(), "municipio_emitente" => $issuer->getAddress()->getCity(), "uf_emitente" => $issuer->getAddress()->getState(), "cep_emitente" => $issuer->getAddress()->getZipCode(), "telefone_emitente" => '', "inscricao_estadual_emitente" => $issuer->getStateRegistration(), "nome_destinatario" => $receiver->getName(), "cnpj_destinatario" => $receiver->getDocumentCNPJ(), "cpf_destinatario" => $receiver->getDocumentCPF(), "inscricao_estadual_destinatario" => $receiver->getStateRegistration(), "telefone_destinatario" => '', "email_destinatario" => $receiver->getEmail(), "logradouro_destinatario" => $receiver->getAddress()->getStreet(), "numero_destinatario" => $receiver->getAddress()->getNumber(), "bairro_destinatario" => $receiver->getAddress()->getNeighborhood(), "municipio_destinatario" => $receiver->getAddress()->getCity(), "uf_destinatario" => $receiver->getAddress()->getState(), "pais_destinatario" => 'Brasil', "cep_destinatario" => $receiver->getAddress()->getZipCode(), "icms_base_calculo" => '0', "icms_valor_total" => '0', "icms_base_calculo_st" => '0', "icms_valor_total_st" => '0', "icms_modalidade_base_calculo" => '0', "icms_valor" => '0', "valor_frete" => '0', "valor_seguro" => '0', "valor_total" => $items->getTotal(), "valor_produtos" => $items->getTotal(), "valor_ipi" => '0', "modalidade_frete" => '0', "informacoes_adicionais_contribuinte" => '', "items" => $items->getItems());
     if (!is_null($duplicatas) && $duplicatas->count()) {
         $this->_nfse['duplicatas'] = $duplicatas->getDuplicatas();
     }
 }
コード例 #2
0
ファイル: insert.php プロジェクト: dindigital/nfe-focus
    $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 {
    echo "ERROR";