Code Duplication    Length = 90-90 lines in 2 locations

src/CTe/Dacte.php 1 location

@@ 1892-1981 (lines=90) @@
1889
     * @param  number $y Posição vertical canto superior
1890
     * @return number Posição vertical final
1891
     */
1892
    protected function zCompValorServ($x = 0, $y = 0)
1893
    {
1894
        $oldX = $x;
1895
        $oldY = $y;
1896
        if ($this->orientacao == 'P') {
1897
            $maxW = $this->wPrint;
1898
        } else {
1899
            $maxW = $this->wPrint - $this->wCanhoto;
1900
        }
1901
        $w = $maxW;
1902
        $h = 25;
1903
        $texto = 'COMPONENTES DO VALOR DA PRESTAÇÃO DO SERVIÇO';
1904
        $aFont = $this->formatPadrao;
1905
        $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
1906
        $y += 3.4;
1907
        $this->pdf->Line($x, $y, $w + 1, $y);
1908
        $texto = 'NOME';
1909
        $aFont = $this->formatPadrao;
1910
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1911
        $yIniDados = $y;
1912
        $x = $w * 0.14;
1913
        $texto = 'VALOR';
1914
        $aFont = $this->formatPadrao;
1915
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1916
        $x = $w * 0.28;
1917
        $this->pdf->Line($x, $y, $x, $y + 21.5);
1918
        $texto = 'NOME';
1919
        $aFont = $this->formatPadrao;
1920
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1921
        $x = $w * 0.42;
1922
        $texto = 'VALOR';
1923
        $aFont = $this->formatPadrao;
1924
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1925
        $x = $w * 0.56;
1926
        $this->pdf->Line($x, $y, $x, $y + 21.5);
1927
        $texto = 'NOME';
1928
        $aFont = $this->formatPadrao;
1929
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1930
        $x = $w * 0.70;
1931
        $texto = 'VALOR';
1932
        $aFont = $this->formatPadrao;
1933
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1934
        $x = $w * 0.86;
1935
        $this->pdf->Line($x, $y, $x, $y + 21.5);
1936
        $y += 1;
1937
        $texto = 'VALOR TOTAL DO SERVIÇO';
1938
        $aFont = $this->formatPadrao;
1939
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1940
        $texto = number_format($this->pSimpleGetValue($this->vPrest, "vTPrest"), 2, ",", ".");
1941
        $aFont = array(
1942
            'font' => $this->fontePadrao,
1943
            'size' => 9,
1944
            'style' => 'B');
1945
        $this->pTextBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1946
        $y += 10;
1947
        $this->pdf->Line($x, $y, $w + 1, $y);
1948
        $y += 1;
1949
        $texto = 'VALOR A RECEBER';
1950
        $aFont = $this->formatPadrao;
1951
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1952
        $texto = number_format($this->pSimpleGetValue($this->vPrest, "vRec"), 2, ",", ".");
1953
        $aFont = array(
1954
            'font' => $this->fontePadrao,
1955
            'size' => 9,
1956
            'style' => 'B');
1957
        $this->pTextBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1958
        $auxX = $oldX;
1959
        $yIniDados += 4;
1960
        foreach ($this->Comp as $k => $d) {
1961
            $nome = $this->Comp->item($k)->getElementsByTagName('xNome')->item(0)->nodeValue;
1962
            $valor = number_format(
1963
                $this->Comp->item($k)->getElementsByTagName('vComp')->item(0)->nodeValue,
1964
                2,
1965
                ",",
1966
                "."
1967
            );
1968
            if ($auxX > $w * 0.60) {
1969
                $yIniDados = $yIniDados + 4;
1970
                $auxX = $oldX;
1971
            }
1972
            $texto = $nome;
1973
            $aFont = $this->formatPadrao;
1974
            $this->pTextBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1975
            $auxX += $w * 0.14;
1976
            $texto = $valor;
1977
            $aFont = $this->formatPadrao;
1978
            $this->pTextBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1979
            $auxX += $w * 0.14;
1980
        }
1981
    } //fim da função compValorDACTE
1982
1983
    /**
1984
     * zImpostos

src/CTe/DacteV3.php 1 location

@@ 1866-1955 (lines=90) @@
1863
     * @param  number $y Posição vertical canto superior
1864
     * @return number Posição vertical final
1865
     */
1866
    protected function zCompValorServ($x = 0, $y = 0)
1867
    {
1868
        $oldX = $x;
1869
        $oldY = $y;
1870
        if ($this->orientacao == 'P') {
1871
            $maxW = $this->wPrint;
1872
        } else {
1873
            $maxW = $this->wPrint - $this->wCanhoto;
1874
        }
1875
        $w = $maxW;
1876
        $h = 25;
1877
        $texto = 'COMPONENTES DO VALOR DA PRESTAÇÃO DO SERVIÇO';
1878
        $aFont = $this->formatPadrao;
1879
        $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, '');
1880
        $y += 3.4;
1881
        $this->pdf->Line($x, $y, $w + 1, $y);
1882
        $texto = 'NOME';
1883
        $aFont = $this->formatPadrao;
1884
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1885
        $yIniDados = $y;
1886
        $x = $w * 0.14;
1887
        $texto = 'VALOR';
1888
        $aFont = $this->formatPadrao;
1889
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1890
        $x = $w * 0.28;
1891
        $this->pdf->Line($x, $y, $x, $y + 21.5);
1892
        $texto = 'NOME';
1893
        $aFont = $this->formatPadrao;
1894
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1895
        $x = $w * 0.42;
1896
        $texto = 'VALOR';
1897
        $aFont = $this->formatPadrao;
1898
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1899
        $x = $w * 0.56;
1900
        $this->pdf->Line($x, $y, $x, $y + 21.5);
1901
        $texto = 'NOME';
1902
        $aFont = $this->formatPadrao;
1903
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1904
        $x = $w * 0.70;
1905
        $texto = 'VALOR';
1906
        $aFont = $this->formatPadrao;
1907
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1908
        $x = $w * 0.86;
1909
        $this->pdf->Line($x, $y, $x, $y + 21.5);
1910
        $y += 1;
1911
        $texto = 'VALOR TOTAL DO SERVIÇO';
1912
        $aFont = $this->formatPadrao;
1913
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1914
        $texto = number_format($this->pSimpleGetValue($this->vPrest, "vTPrest"), 2, ",", ".");
1915
        $aFont = array(
1916
            'font' => $this->fontePadrao,
1917
            'size' => 9,
1918
            'style' => 'B');
1919
        $this->pTextBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1920
        $y += 10;
1921
        $this->pdf->Line($x, $y, $w + 1, $y);
1922
        $y += 1;
1923
        $texto = 'VALOR A RECEBER';
1924
        $aFont = $this->formatPadrao;
1925
        $this->pTextBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1926
        $texto = number_format($this->pSimpleGetValue($this->vPrest, "vRec"), 2, ",", ".");
1927
        $aFont = array(
1928
            'font' => $this->fontePadrao,
1929
            'size' => 9,
1930
            'style' => 'B');
1931
        $this->pTextBox($x, $y + 4, $w * 0.14, $h, $texto, $aFont, 'T', 'C', 0, '');
1932
        $auxX = $oldX;
1933
        $yIniDados += 4;
1934
        foreach ($this->Comp as $k => $d) {
1935
            $nome = $this->Comp->item($k)->getElementsByTagName('xNome')->item(0)->nodeValue;
1936
            $valor = number_format(
1937
                $this->Comp->item($k)->getElementsByTagName('vComp')->item(0)->nodeValue,
1938
                2,
1939
                ",",
1940
                "."
1941
            );
1942
            if ($auxX > $w * 0.60) {
1943
                $yIniDados = $yIniDados + 4;
1944
                $auxX = $oldX;
1945
            }
1946
            $texto = $nome;
1947
            $aFont = $this->formatPadrao;
1948
            $this->pTextBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1949
            $auxX += $w * 0.14;
1950
            $texto = $valor;
1951
            $aFont = $this->formatPadrao;
1952
            $this->pTextBox($auxX, $yIniDados, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');
1953
            $auxX += $w * 0.14;
1954
        }
1955
    } //fim da função compValorDACTE
1956
1957
    /**
1958
     * zImpostos