Code Duplication    Length = 116-116 lines in 2 locations

src/CTe/Dacte.php 1 location

@@ 1078-1193 (lines=116) @@
1075
            $this->pdf->SetTextColor(0, 0, 0);
1076
        }
1077
        //indicar sem valor
1078
        if ($tpAmb != 1 && $this->preVisualizar=='0') { // caso não seja uma DA de produção
1079
            $x = 10;
1080
            if ($this->orientacao == 'P') {
1081
                $y = round($this->hPrint * 2 / 3, 0);
1082
            } else {
1083
                $y = round($this->hPrint / 2, 0);
1084
            }
1085
            $h = 5;
1086
            $w = $maxW - (2 * $x);
1087
            $this->pdf->SetTextColor(90, 90, 90);
1088
            $texto = "SEM VALOR FISCAL";
1089
            $aFont = array(
1090
                'font' => $this->fontePadrao,
1091
                'size' => 48,
1092
                'style' => 'B');
1093
            $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1094
            $aFont = array(
1095
                'font' => $this->fontePadrao,
1096
                'size' => 30,
1097
                'style' => 'B');
1098
            $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1099
            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1100
            $this->pdf->SetTextColor(0, 0, 0);
1101
        } elseif ($this->preVisualizar=='1') { // caso seja uma DA de Pré-Visualização
1102
            $h = 5;
1103
            $w = $maxW - (2 * 10);
1104
            $x = 55;
1105
            $y = 240;
1106
            $this->pdf->SetTextColor(255, 100, 100);
1107
            $aFont = array(
1108
                'font' => $this->fontePadrao,
1109
                'size' => 40,
1110
                'style' => 'B');
1111
            $texto = "Pré-visualização";
1112
            $this->pTextBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1113
            $this->pdf->SetTextColor(255, 100, 100);
1114
            $aFont = array(
1115
                'font' => $this->fontePadrao,
1116
                'size' => 41,
1117
                'style' => 'B');
1118
            $texto = "Sem Validade Jurídica";
1119
            $this->pTextBox90($x+20, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1120
            $this->pdf->SetTextColor(90, 90, 90);
1121
            $texto = "SEM VALOR FISCAL";
1122
            $aFont = array(
1123
                'font' => $this->fontePadrao,
1124
                'size' => 48,
1125
                'style' => 'B');
1126
            $this->pTextBox90($x+40, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1127
            $this->pdf->SetTextColor(0, 0, 0); // voltar a cor default
1128
        } else {
1129
            $x = 10;
1130
            if ($this->orientacao == 'P') {
1131
                $y = round($this->hPrint * 2 / 3, 0);
1132
            } else {
1133
                $y = round($this->hPrint / 2, 0);
1134
            } //fim orientacao
1135
            $h = 5;
1136
            $w = $maxW - (2 * $x);
1137
            $this->pdf->SetTextColor(90, 90, 90);
1138
            //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1139
            if (($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) && !$this->zCteDPEC()) {
1140
                //Contingência
1141
                $texto = "DACTE Emitido em Contingência";
1142
                $aFont = array(
1143
                    'font' => $this->fontePadrao,
1144
                    'size' => 48,
1145
                    'style' => 'B');
1146
                $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1147
                $aFont = array(
1148
                    'font' => $this->fontePadrao,
1149
                    'size' => 30,
1150
                    'style' => 'B');
1151
                $texto = "devido à problemas técnicos";
1152
                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1153
            } else {
1154
                if (!isset($this->cteProc)) {
1155
                    if (!$this->zCteDPEC()) {
1156
                        $texto = "SEM VALOR FISCAL";
1157
                        $aFont = array(
1158
                            'font' => $this->fontePadrao,
1159
                            'size' => 48,
1160
                            'style' => 'B');
1161
                        $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1162
                    }
1163
                    $aFont = array(
1164
                        'font' => $this->fontePadrao,
1165
                        'size' => 30,
1166
                        'style' => 'B');
1167
                    $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1168
                    if (!$this->zCteDPEC()) {
1169
                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1170
                    } else {
1171
                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1172
                    }
1173
                } //fim cteProc
1174
                if ($this->tpEmis == 4) {
1175
                    //DPEC
1176
                    $x = 10;
1177
                    $y = $this->hPrint - 130;
1178
                    $h = 25;
1179
                    $w = $maxW - (2 * $x);
1180
                    $this->pdf->SetTextColor(200, 200, 200); // 90,90,90 é muito escuro
1181
                    $texto = "DACTE impresso em contingência -\n"
1182
                        . "DPEC regularmente recebido pela Receita\n"
1183
                        . "Federal do Brasil";
1184
                    $aFont = array(
1185
                        'font' => $this->fontePadrao,
1186
                        'size' => 48,
1187
                        'style' => 'B');
1188
                    $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1189
                    $this->pdf->SetTextColor(0, 0, 0);
1190
                }
1191
            } //fim tpEmis
1192
            $this->pdf->SetTextColor(0, 0, 0);
1193
        }
1194
        return $oldY;
1195
    } //fim zCabecalho
1196

src/CTe/DacteV3.php 1 location

@@ 1068-1183 (lines=116) @@
1065
            $this->pdf->SetTextColor(0, 0, 0);
1066
        }
1067
        //indicar sem valor
1068
        if ($tpAmb != 1 && $this->preVisualizar=='0') { // caso não seja uma DA de produção
1069
            $x = 10;
1070
            if ($this->orientacao == 'P') {
1071
                $y = round($this->hPrint * 2 / 3, 0);
1072
            } else {
1073
                $y = round($this->hPrint / 2, 0);
1074
            }
1075
            $h = 5;
1076
            $w = $maxW - (2 * $x);
1077
            $this->pdf->SetTextColor(90, 90, 90);
1078
            $texto = "SEM VALOR FISCAL";
1079
            $aFont = array(
1080
                'font' => $this->fontePadrao,
1081
                'size' => 48,
1082
                'style' => 'B');
1083
            $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1084
            $aFont = array(
1085
                'font' => $this->fontePadrao,
1086
                'size' => 30,
1087
                'style' => 'B');
1088
            $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1089
            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1090
            $this->pdf->SetTextColor(0, 0, 0);
1091
        } elseif ($this->preVisualizar=='1') { // caso seja uma DA de Pré-Visualização
1092
            $h = 5;
1093
            $w = $maxW - (2 * 10);
1094
            $x = 55;
1095
            $y = 240;
1096
            $this->pdf->SetTextColor(255, 100, 100);
1097
            $aFont = array(
1098
                'font' => $this->fontePadrao,
1099
                'size' => 40,
1100
                'style' => 'B');
1101
            $texto = "Pré-visualização";
1102
            $this->pTextBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1103
            $this->pdf->SetTextColor(255, 100, 100);
1104
            $aFont = array(
1105
                'font' => $this->fontePadrao,
1106
                'size' => 41,
1107
                'style' => 'B');
1108
            $texto = "Sem Validade Jurídica";
1109
            $this->pTextBox90($x+20, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1110
            $this->pdf->SetTextColor(90, 90, 90);
1111
            $texto = "SEM VALOR FISCAL";
1112
            $aFont = array(
1113
                'font' => $this->fontePadrao,
1114
                'size' => 48,
1115
                'style' => 'B');
1116
            $this->pTextBox90($x+40, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1117
            $this->pdf->SetTextColor(0, 0, 0); // voltar a cor default
1118
        } else {
1119
            $x = 10;
1120
            if ($this->orientacao == 'P') {
1121
                $y = round($this->hPrint * 2 / 3, 0);
1122
            } else {
1123
                $y = round($this->hPrint / 2, 0);
1124
            } //fim orientacao
1125
            $h = 5;
1126
            $w = $maxW - (2 * $x);
1127
            $this->pdf->SetTextColor(90, 90, 90);
1128
            //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1129
            if (($this->tpEmis == 5 || $this->tpEmis == 7 || $this->tpEmis == 8) && !$this->zCteDPEC()) {
1130
                //Contingência
1131
                $texto = "DACTE Emitido em Contingência";
1132
                $aFont = array(
1133
                    'font' => $this->fontePadrao,
1134
                    'size' => 48,
1135
                    'style' => 'B');
1136
                $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1137
                $aFont = array(
1138
                    'font' => $this->fontePadrao,
1139
                    'size' => 30,
1140
                    'style' => 'B');
1141
                $texto = "devido à problemas técnicos";
1142
                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1143
            } else {
1144
                if (!isset($this->protCTe)) {
1145
                    if (!$this->zCteDPEC()) {
1146
                        $texto = "SEM VALOR FISCAL";
1147
                        $aFont = array(
1148
                            'font' => $this->fontePadrao,
1149
                            'size' => 48,
1150
                            'style' => 'B');
1151
                        $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1152
                    }
1153
                    $aFont = array(
1154
                        'font' => $this->fontePadrao,
1155
                        'size' => 30,
1156
                        'style' => 'B');
1157
                    $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1158
                    if (!$this->zCteDPEC()) {
1159
                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1160
                    } else {
1161
                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1162
                    }
1163
                } //fim cteProc
1164
                if ($this->tpEmis == 4) {
1165
                    //DPEC
1166
                    $x = 10;
1167
                    $y = $this->hPrint - 130;
1168
                    $h = 25;
1169
                    $w = $maxW - (2 * $x);
1170
                    $this->pdf->SetTextColor(200, 200, 200); // 90,90,90 é muito escuro
1171
                    $texto = "DACTE impresso em contingência -\n"
1172
                        . "DPEC regularmente recebido pela Receita\n"
1173
                        . "Federal do Brasil";
1174
                    $aFont = array(
1175
                        'font' => $this->fontePadrao,
1176
                        'size' => 48,
1177
                        'style' => 'B');
1178
                    $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1179
                    $this->pdf->SetTextColor(0, 0, 0);
1180
                }
1181
            } //fim tpEmis
1182
            $this->pdf->SetTextColor(0, 0, 0);
1183
        }
1184
        return $oldY;
1185
    } //fim zCabecalho
1186