-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.php
More file actions
70 lines (61 loc) · 1.65 KB
/
index.php
File metadata and controls
70 lines (61 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require_once('./vendor/autoload.php');
use NFePHP\NFCom\Make;
$nfcom = new Make();
$data = [
'Id' => 1,
'versao' => 1,
'cUF'=> 1,
'tpAmb'=> 1,
'mod'=> 1,
'serie'=> 1,
'nNF'=> 1,
'cNF'=> 1,
'cDV'=> 1,
'dhEmi'=> 1,
'tpEmis'=> 1,
'nSiteAutoriz'=> 1,
'cMunFG'=> 1,
'finNFCom'=> 1,
'tpFat'=> 1,
'verProc'=> 1,
'indPrePago'=> 1,
'indCessaoMeiosRede'=> 1,
'dhCont'=> 1,
'xJust'=> 1,
];
$std = new \stdClass();
$std->Id = $data['Id'] ?? null;
$std->versao = $data['versao'] ?? null;
$nfcom->tagInfNFCom($std);
$std = new \stdClass();
$std->cUF = $data['cUF'] ?? null;
$std->tpAmb = $data['tpAmb'] ?? null;
$std->mod = $data['mod'] ?? null;
$std->serie = $data['serie'] ?? null;
$std->nNF = $data['nNF'] ?? null;
$std->cNF = $data['cNF'] ?? null;
$std->cDV = $data['cDV'] ?? null;
$std->dhEmi = $data['dhEmi'] ?? null;
$std->tpEmis = $data['tpEmis'] ?? null;
$std->nSiteAutoriz = $data['nSiteAutoriz'] ?? null;
$std->cMunFG = $data['cMunFG'] ?? null;
$std->finNFCom = $data['finNFCom'] ?? null;
$std->tpFat = $data['tpFat'] ?? null;
$std->verProc = $data['verProc'] ?? null;
$std->indPrePago = $data['indPrePago'] ?? null;
$std->indCessaoMeiosRede = $data['indCessaoMeiosRede'] ?? null;
$std->dhCont = $data['dhCont'] ?? null;
$std->xJust = $data['xJust'] ?? null;
$nfcom->tagIde($std);
try {
$nfcom->monta();
} catch (\Exception $e) {
$error['nNF'] = $data['nNF'];
$error['erros'] = $nfcom->getErrors();
throw new \Exception(json_encode($error), 400);
}
var_dump($nfcom);
// header('Content-type: text/xml');
// header('Content-Disposition: attachment; filename="nfcom.xml"');
// echo $nfcom->getXML();