Code Duplication    Length = 161-161 lines in 2 locations

src/CTe/Dacte.php 1 location

@@ 2829-2989 (lines=161) @@
2826
     * @param  number $y Posição vertical canto superior
2827
     * @return number Posição vertical final
2828
     */
2829
    protected function zModalAquaviario($x = 0, $y = 0)
2830
    {
2831
        $oldX = $x;
2832
        $oldY = $y;
2833
        if ($this->orientacao == 'P') {
2834
            $maxW = $this->wPrint;
2835
        } else {
2836
            $maxW = $this->wPrint - $this->wCanhoto;
2837
        }
2838
        $w = $maxW;
2839
        $h = 8.5;
2840
        $texto = 'DADOS ESPECÍFICOS DO MODAL AQUAVIÁRIO';
2841
        $aFont = $this->formatPadrao;
2842
        $this->pTextBox($x, $y, $w, $h * 3.2, $texto, $aFont, 'T', 'C', 1, '');
2843
        $y += 3.4;
2844
        $this->pdf->Line($x, $y, $w + 1, $y);
2845
        $texto = 'PORTO DE EMBARQUE';
2846
        $aFont = $this->formatPadrao;
2847
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2848
        $texto = $this->pSimpleGetValue($this->aquav, "prtEmb");
2849
        $aFont = $this->formatNegrito;
2850
        $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2851
        $x += $w * 0.50;
2852
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2853
        $texto = 'PORTO DE DESTINO';
2854
        $aFont = $this->formatPadrao;
2855
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2856
        $texto = $this->pSimpleGetValue($this->aquav, "prtDest");
2857
        $aFont = $this->formatNegrito;
2858
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2859
        $y += 8;
2860
        $this->pdf->Line(208, $y, 1, $y);
2861
        $x = 1;
2862
        $texto = 'IDENTIFICAÇÃO DO NAVIO / REBOCADOR';
2863
        $aFont = $this->formatPadrao;
2864
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2865
        $texto = $this->pSimpleGetValue($this->aquav, "xNavio");
2866
        $aFont = $this->formatNegrito;
2867
        $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2868
        $x += $w * 0.50;
2869
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2870
        $texto = 'VR DA B. DE CALC. AFRMM';
2871
        $aFont = $this->formatPadrao;
2872
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2873
        $texto = $this->pSimpleGetValue($this->aquav, "vPrest");
2874
        $aFont = $this->formatNegrito;
2875
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2876
        $x += $w * 0.17;
2877
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2878
        $texto = 'VALOR DO AFRMM';
2879
        $aFont = $this->formatPadrao;
2880
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2881
        $texto = $this->pSimpleGetValue($this->aquav, "vAFRMM");
2882
        $aFont = $this->formatNegrito;
2883
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2884
        $x += $w * 0.12;
2885
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2886
        $texto = 'TIPO DE NAVEGAÇÃO';
2887
        $aFont = $this->formatPadrao;
2888
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2889
        $texto = $this->pSimpleGetValue($this->aquav, "tpNav");
2890
        switch ($texto) {
2891
            case '0':
2892
                $texto = 'INTERIOR';
2893
                break;
2894
            case '1':
2895
                $texto = 'CABOTAGEM';
2896
                break;
2897
        }
2898
        $aFont = $this->formatNegrito;
2899
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2900
        $x += $w * 0.14;
2901
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2902
        $texto = 'DIREÇÃO';
2903
        $aFont = $this->formatPadrao;
2904
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2905
        $texto = $this->pSimpleGetValue($this->aquav, "direc");
2906
        switch ($texto) {
2907
            case 'N':
2908
                $texto = 'NORTE';
2909
                break;
2910
            case 'L':
2911
                $texto = 'LESTE';
2912
                break;
2913
            case 'S':
2914
                $texto = 'SUL';
2915
                break;
2916
            case 'O':
2917
                $texto = 'OESTE';
2918
                break;
2919
        }
2920
        $aFont = $this->formatNegrito;
2921
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2922
        $y += 8;
2923
        $this->pdf->Line(208, $y, 1, $y);
2924
        $x = 1;
2925
        $texto = 'IDENTIFICAÇÃO DOS CONTEINERS';
2926
        $aFont = $this->formatPadrao;
2927
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2928
        if ($this->infNF->item(0) !== null && $this->infNF->item(0)->getElementsByTagName('infUnidCarga') !== null) {
2929
            $texto = $this->infNF
2930
                ->item(0)
2931
                ->getElementsByTagName('infUnidCarga')
2932
                ->item(0)
2933
                ->getElementsByTagName('idUnidCarga')
2934
                ->item(0)->nodeValue;
2935
        } elseif ($this->infNFe->item(0) !== null
2936
            && $this->infNFe->item(0)->getElementsByTagName('infUnidCarga') !== null
2937
        ) {
2938
            $texto = $this->infNFe
2939
                ->item(0)
2940
                ->getElementsByTagName('infUnidCarga')
2941
                ->item(0)
2942
                ->getElementsByTagName('idUnidCarga')
2943
                ->item(0)
2944
                ->nodeValue;
2945
        } elseif ($this->infOutros->item(0) !== null
2946
            && $this->infOutros->item(0)->getElementsByTagName('infUnidCarga') !== null
2947
        ) {
2948
            $texto = $this->infOutros
2949
                ->item(0)
2950
                ->getElementsByTagName('infUnidCarga')
2951
                ->item(0)
2952
                ->getElementsByTagName('idUnidCarga')
2953
                ->item(0)
2954
                ->nodeValue;
2955
        } else {
2956
            $texto = '';
2957
        }
2958
        $aFont = $this->formatNegrito;
2959
        $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2960
        $x += $w * 0.50;
2961
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2962
        $texto = 'IDENTIFICAÇÃO DAS BALSAS';
2963
        $aFont = $this->formatPadrao;
2964
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2965
        $texto = '';
2966
        if ($this->pSimpleGetValue($this->aquav, "balsa") !== '') {
2967
            foreach ($this->aquav->getElementsByTagName('balsa') as $k => $d) {
2968
                if ($k == 0) {
2969
                    $texto = $this->aquav
2970
                        ->getElementsByTagName('balsa')
2971
                        ->item($k)
2972
                        ->getElementsByTagName('xBalsa')
2973
                        ->item(0)
2974
                        ->nodeValue;
2975
                } else {
2976
                    $texto = $texto
2977
                        . ' / '
2978
                        . $this->aquav
2979
                            ->getElementsByTagName('balsa')
2980
                            ->item($k)
2981
                            ->getElementsByTagName('xBalsa')
2982
                            ->item(0)
2983
                            ->nodeValue;
2984
                }
2985
            }
2986
        }
2987
        $aFont = $this->formatNegrito;
2988
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2989
    } //fim da função zModalRod
2990
2991
    /**
2992
     * zModalFerr

src/CTe/DacteV3.php 1 location

@@ 2618-2778 (lines=161) @@
2615
     * @param  number $y Posição vertical canto superior
2616
     * @return number Posição vertical final
2617
     */
2618
    protected function zModalAquaviario($x = 0, $y = 0)
2619
    {
2620
        $oldX = $x;
2621
        $oldY = $y;
2622
        if ($this->orientacao == 'P') {
2623
            $maxW = $this->wPrint;
2624
        } else {
2625
            $maxW = $this->wPrint - $this->wCanhoto;
2626
        }
2627
        $w = $maxW;
2628
        $h = 8.5;
2629
        $texto = 'DADOS ESPECÍFICOS DO MODAL AQUAVIÁRIO';
2630
        $aFont = $this->formatPadrao;
2631
        $this->pTextBox($x, $y, $w, $h * 3.2, $texto, $aFont, 'T', 'C', 1, '');
2632
        $y += 3.4;
2633
        $this->pdf->Line($x, $y, $w + 1, $y);
2634
        $texto = 'PORTO DE EMBARQUE';
2635
        $aFont = $this->formatPadrao;
2636
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2637
        $texto = $this->pSimpleGetValue($this->aquav, "prtEmb");
2638
        $aFont = $this->formatNegrito;
2639
        $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2640
        $x += $w * 0.50;
2641
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2642
        $texto = 'PORTO DE DESTINO';
2643
        $aFont = $this->formatPadrao;
2644
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2645
        $texto = $this->pSimpleGetValue($this->aquav, "prtDest");
2646
        $aFont = $this->formatNegrito;
2647
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2648
        $y += 8;
2649
        $this->pdf->Line(208, $y, 1, $y);
2650
        $x = 1;
2651
        $texto = 'IDENTIFICAÇÃO DO NAVIO / REBOCADOR';
2652
        $aFont = $this->formatPadrao;
2653
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2654
        $texto = $this->pSimpleGetValue($this->aquav, "xNavio");
2655
        $aFont = $this->formatNegrito;
2656
        $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2657
        $x += $w * 0.50;
2658
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2659
        $texto = 'VR DA B. DE CALC. AFRMM';
2660
        $aFont = $this->formatPadrao;
2661
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2662
        $texto = $this->pSimpleGetValue($this->aquav, "vPrest");
2663
        $aFont = $this->formatNegrito;
2664
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2665
        $x += $w * 0.17;
2666
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2667
        $texto = 'VALOR DO AFRMM';
2668
        $aFont = $this->formatPadrao;
2669
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2670
        $texto = $this->pSimpleGetValue($this->aquav, "vAFRMM");
2671
        $aFont = $this->formatNegrito;
2672
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2673
        $x += $w * 0.12;
2674
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2675
        $texto = 'TIPO DE NAVEGAÇÃO';
2676
        $aFont = $this->formatPadrao;
2677
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2678
        $texto = $this->pSimpleGetValue($this->aquav, "tpNav");
2679
        switch ($texto) {
2680
            case '0':
2681
                $texto = 'INTERIOR';
2682
                break;
2683
            case '1':
2684
                $texto = 'CABOTAGEM';
2685
                break;
2686
        }
2687
        $aFont = $this->formatNegrito;
2688
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2689
        $x += $w * 0.14;
2690
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2691
        $texto = 'DIREÇÃO';
2692
        $aFont = $this->formatPadrao;
2693
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2694
        $texto = $this->pSimpleGetValue($this->aquav, "direc");
2695
        switch ($texto) {
2696
            case 'N':
2697
                $texto = 'NORTE';
2698
                break;
2699
            case 'L':
2700
                $texto = 'LESTE';
2701
                break;
2702
            case 'S':
2703
                $texto = 'SUL';
2704
                break;
2705
            case 'O':
2706
                $texto = 'OESTE';
2707
                break;
2708
        }
2709
        $aFont = $this->formatNegrito;
2710
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2711
        $y += 8;
2712
        $this->pdf->Line(208, $y, 1, $y);
2713
        $x = 1;
2714
        $texto = 'IDENTIFICAÇÃO DOS CONTEINERS';
2715
        $aFont = $this->formatPadrao;
2716
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2717
        if ($this->infNF->item(0) !== null && $this->infNF->item(0)->getElementsByTagName('infUnidCarga') !== null) {
2718
            $texto = $this->infNF
2719
                ->item(0)
2720
                ->getElementsByTagName('infUnidCarga')
2721
                ->item(0)
2722
                ->getElementsByTagName('idUnidCarga')
2723
                ->item(0)->nodeValue;
2724
        } elseif ($this->infNFe->item(0) !== null
2725
            && $this->infNFe->item(0)->getElementsByTagName('infUnidCarga') !== null
2726
        ) {
2727
            $texto = $this->infNFe
2728
                ->item(0)
2729
                ->getElementsByTagName('infUnidCarga')
2730
                ->item(0)
2731
                ->getElementsByTagName('idUnidCarga')
2732
                ->item(0)
2733
                ->nodeValue;
2734
        } elseif ($this->infOutros->item(0) !== null
2735
            && $this->infOutros->item(0)->getElementsByTagName('infUnidCarga') !== null
2736
        ) {
2737
            $texto = $this->infOutros
2738
                ->item(0)
2739
                ->getElementsByTagName('infUnidCarga')
2740
                ->item(0)
2741
                ->getElementsByTagName('idUnidCarga')
2742
                ->item(0)
2743
                ->nodeValue;
2744
        } else {
2745
            $texto = '';
2746
        }
2747
        $aFont = $this->formatNegrito;
2748
        $this->pTextBox($x, $y + 3, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2749
        $x += $w * 0.50;
2750
        $this->pdf->Line($x, $y, $x, $y + 7.7);
2751
        $texto = 'IDENTIFICAÇÃO DAS BALSAS';
2752
        $aFont = $this->formatPadrao;
2753
        $this->pTextBox($x, $y, $w * 0.23, $h, $texto, $aFont, 'T', 'L', 0, '');
2754
        $texto = '';
2755
        if ($this->pSimpleGetValue($this->aquav, "balsa") !== '') {
2756
            foreach ($this->aquav->getElementsByTagName('balsa') as $k => $d) {
2757
                if ($k == 0) {
2758
                    $texto = $this->aquav
2759
                        ->getElementsByTagName('balsa')
2760
                        ->item($k)
2761
                        ->getElementsByTagName('xBalsa')
2762
                        ->item(0)
2763
                        ->nodeValue;
2764
                } else {
2765
                    $texto = $texto
2766
                        . ' / '
2767
                        . $this->aquav
2768
                            ->getElementsByTagName('balsa')
2769
                            ->item($k)
2770
                            ->getElementsByTagName('xBalsa')
2771
                            ->item(0)
2772
                            ->nodeValue;
2773
                }
2774
            }
2775
        }
2776
        $aFont = $this->formatNegrito;
2777
        $this->pTextBox($x, $y + 3, $w * 0.50, $h, $texto, $aFont, 'T', 'L', 0, '');
2778
    } //fim da função zModalRod
2779
2780
    /**
2781
     * zModalFerr