Skip to content

Commit

Permalink
[UPD] Make::class, Convert::class, ValidTXT::class, Parser::class par…
Browse files Browse the repository at this point in the history
…a NT_2018_005_v1.2
  • Loading branch information
robmachado committed Mar 20, 2019
1 parent f8041ac commit 51a83cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/Common/ValidTXT.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class ValidTXT
{
const LOCAL="LOCAL";
const LOCAL_V12 = "LOCAL_V12";
const SEBRAE="SEBRAE";

/**
Expand All @@ -33,6 +34,8 @@ public static function loadStructure($version = 4.00, $baselayout = self::LOCAL)
$comp = '';
if (strtoupper($baselayout) === 'SEBRAE') {
$comp = '_sebrae';
} elseif (strtoupper($baselayout) === 'LOCAL_V12') {
$comp = '_v1.2';
}
$file = $path . '/txtstructure' . ($version*100) . $comp . '.json';
if (!is_file($file)) {
Expand Down
7 changes: 4 additions & 3 deletions src/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

class Convert
{
const LOCAL="LOCAL";
const SEBRAE="SEBRAE";
const LOCAL = "LOCAL";
const LOCAL_V12 = "LOCAL_V12";
const SEBRAE = "SEBRAE";

protected $txt;
protected $dados;
Expand Down Expand Up @@ -64,7 +65,7 @@ public static function parse($txt, $baselayout = self::LOCAL)
public function toXml()
{
//$txt = Strings::removeSomeAlienCharsfromTxt($this->txt);

if (!$this->isNFe($this->txt)) {
throw DocumentsException::wrongDocument(12, '');
}
Expand Down
7 changes: 5 additions & 2 deletions src/Factories/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

class Parser
{
const LOCAL="LOCAL";
const SEBRAE="SEBRAE";
const LOCAL = "LOCAL";
const LOCAL_V12 = "LOCAL_V12";
const SEBRAE = "SEBRAE";

/**
* @var array
Expand Down Expand Up @@ -116,6 +117,8 @@ public function __construct($version = '4.00', $baselayout = self::LOCAL)
$comp = "";
if ($baselayout === 'SEBRAE') {
$comp = "_sebrae";
} elseif ($baselayout == 'LOCAL_V12') {
$comp = "_v1.2";
}
$this->baselayout = $baselayout;
$path = realpath(__DIR__."/../../storage/txtstructure$ver" . $comp . ".json");
Expand Down
5 changes: 3 additions & 2 deletions src/Make.php
Original file line number Diff line number Diff line change
Expand Up @@ -4446,7 +4446,7 @@ public function tagICMSSN(stdClass $std)
$this->dom->addChild(
$icmsSN,
'vICMSSubstituto',
$std->vICMSSubstituto,
!empty($std->vICMSSubstituto) ? number_format($std->vICMSSubstituto, 2, '.', '') : null,
false,
"[item $std->item] Valor do ICMS próprio do Substituto"
);
Expand Down Expand Up @@ -7416,6 +7416,7 @@ protected function equilizeParameters(stdClass $std, $possible)
protected function hashCSRT($CSRT)
{
$comb = $CSRT . $this->chNFe;
return sha1($comb);
return base64_encode(sha1($comb, true));
;
}
}

0 comments on commit 51a83cf

Please sign in to comment.