gabriela-castro / Gerenciador-financeiro

Gerenciador financeiro para pequenas empresas
44 stars 34 forks source link

Erro ao Adicionar Fatura #25

Open LeoReAlert opened 1 year ago

LeoReAlert commented 1 year ago

está retornando um erro aqui ao adicionar a fatura que não sei bem como resolver peço ajuda ? Está exibindo um erro aqui nas seguintes linhas:

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 65

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 73

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 75

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 76

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 77

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 78

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 79

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 80

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 81

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 82

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 83

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 84

Meu código aqui:

`<?php $id = (isset($_GET['id']) ? $_GET['id'] : ''); $acao = (isset($_GET['acao']) ? $_GET['acao'] : ''); $tp = (isset($_GET['tp']) ? $_GET['tp'] : ''); $id_cliente = (isset($_GET['id_cliente']) ? $_GET['id_cliente'] : '');

include '../../config/mysql.php'; include '../../config/funcoes.php'; include '../../config/check.php';

$modulo = 'faturas'; $tabela = 'faturas'; $atributos = 'id_cliente=' . $id_cliente;

$vencimento = (isset($_GET['vencimento']) ? data_brasil_eua($_GET['vencimento']) : ''); $id_servico1 = (isset($_GET['id_servico1']) ? $_GET['id_servico1'] : 0); $id_servico2 = (isset($_GET['id_servico2']) ? $_GET['id_servico2'] : 0); $id_servico3 = (isset($_GET['id_servico3']) ? $_GET['id_servico3'] : 0); $id_servico4 = (isset($_GET['id_servico4']) ? $_GET['id_servico4'] : 0); $id_servico5 = (isset($_GET['id_servico5']) ? $_GET['id_servico5'] : 0); $valor1 = (isset($_GET['valor1']) ? vfloat($_GET['valor1']) : 0.0); $valor2 = (isset($_GET['valor2']) ? vfloat($_GET['valor2']) : 0.0); $valor3 = (isset($_GET['valor3']) ? vfloat($_GET['valor3']) : 0.0); $valor4 = (isset($_GET['valor4']) ? vfloat($_GET['valor4']) : 0.0); $valor5 = (isset($_GET['valor5']) ? vfloat($_GET['valor5']) : 0.0); $obs = (isset($_GET['obs']) ? $_GET['obs'] : ''); $data = data_hora();

if ($acao == 'adicionar') { if ($id_servico2 <= 0) { $id_servico2 = 0; } if ($id_servico3 <= 0) { $id_servico3 = 0; } if ($id_servico4 <= 0) { $id_servico4 = 0; } if ($id_servico5 <= 0) { $id_servico5 = 0; } $enviado = Date('Y-m-d');

$sql = "INSERT into $tabela (id_cliente, vencimento, enviado ,id_servico1, id_servico2, id_servico3, id_servico4, id_servico5, valor1, valor2, valor3, valor4, valor5, obs, data, id_admin) VALUES ('$id_cliente', '$vencimento', '$enviado', $id_servico1, $id_servico2, $id_servico3, $id_servico4, $id_servico5, '$valor1', '$valor2', '$valor3', '$valor4', '$valor5', '$obs', '$data', '$id_admin')";
$insert = mysqli_query($link, $sql) or die('Erro gerado -> ' . mysqli_error($link) . '<>' . $sql);

echo '<script>fecharpopup(); ' . $modulo . '(\'?' . $atributos . '\'); </script>';
exit;

} else if ($acao == 'editar') {

mysqli_query($link, "UPDATE $tabela SET id_cliente='$id_cliente', vencimento='$vencimento', id_servico1='$id_servico1', id_servico2='$id_servico2', id_servico3='$id_servico3', id_servico4='$id_servico4', id_servico5='$id_servico5', valor1='$valor1', valor2='$valor2', valor3='$valor3', valor4='$valor4', valor5='$valor5', obs='$obs' WHERE id='$id'");
echo '<script>fecharpopup(); ' . $modulo . '(\'?' . $atributos . '\'); </script>';
exit;

}

$result = mysqli_query($link, "SELECT * FROM $tabela WHERE id='$id'");

$n = mysqli_fetch_array($result, MYSQLI_ASSOC);

$id = $n['id']; if ($id_cliente == '') { $id_cliente = $n['id_cliente']; } if ($tp == 'copia') { echo $vencimento = data_eua_brasil(date('Y-m-d', strtotime("+1 month", strtotime($n['vencimento'])))); //echo $vencimento = data_eua_brasil(date($n['vencimento'], strtotime("+1 months"))); } else { $vencimento = data_eua_brasil($n['vencimento']); } $id_servico1 = $n['id_servico1']; $id_servico2 = $n['id_servico2']; $id_servico3 = $n['id_servico3']; $id_servico4 = $n['id_servico4']; $id_servico5 = $n['id_servico5']; $valor1 = moeda($n['valor1']); $valor2 = moeda($n['valor2']); $valor3 = moeda($n['valor3']); $valor4 = moeda($n['valor4']); $valor5 = moeda($n['valor5']); $obs = utf8_encode($n['obs']);

if ($id_cliente != '') { $tpcli = 'edit'; } else { $tpcli = $tp; } ?>

Cliente:
Vencimento:
Serviço:
Valor:


Serviço:
<?php echo select($tp, 'tiposervicos', 'id_servico2', 'nome', '', $id_servico2); ?>
Valor:

</span>
<span class=" span1"><br />
    <button class="btn btn-success" onclick="ocultar('#bts2','.servico3');" id="bts2" style=" <?php if ($id_servico3 != 0) {
                                                                                                    echo 'display:none;';
                                                                                                } ?>">+1</button>
</span>
<span class=" span1"><br />
    <button class="btn btn-danger" onclick="ocultar('.servico2','#bts1'); $('#id_servico2').val(''); $('#valor2').val('');" id="bt1">-1</button>
</span>

Serviço:
<?php echo select($tp, 'tiposervicos', 'id_servico3', 'nome', '', $id_servico3); ?>
Valor:

</span>
<span class=" span1"><br />
    <button class="btn btn-success" onclick="ocultar('#bts3','.servico4');" id="bts3" style=" <?php if ($id_servico4 != 0) {
                                                                                                    echo 'display:none;';
                                                                                                } ?>">+1</button>
</span>
<span class=" span1"><br />
    <button class="btn btn-danger" onclick="ocultar('.servico3','#bts2'); $('#id_servico3').val(''); $('#valor3').val('');" id="bt2">-1</button>
</span>

Serviço:
<?php echo select($tp, 'tiposervicos', 'id_servico4', 'nome', '', $id_servico4); ?>
Valor:

</span>
<span class=" span1"><br />
    <button class="btn btn-success" onclick="ocultar('#bts4','.servico5');" id="bts4" style=" <?php if ($id_servico5 != 0) {
                                                                                                    echo 'display:none;';
                                                                                                } ?>">+1</button>
</span>
<span class=" span1"><br />
    <button class="btn btn-danger" onclick="ocultar('.servico4','#bts3'); $('#id_servico4').val(''); $('#valor4').val('');" id="bt3">-1</button>
</span>

Serviço:
<?php echo select($tp, 'tiposervicos', 'id_servico5', 'nome', '', $id_servico5); ?>
Valor:

</span>
<span class=" span1"><br />
</span>
<span class=" span1"><br />
    <button class="btn btn-danger" onclick="ocultar('.servico5','#bts4'); $('#id_servico5').val(''); $('#valor5').val('');" id="bt4">-1</button>
</span>

Observações:

<?php if ($tp != 'ver') { ?>

<?php } ?>`

AldySalvino commented 1 year ago

você não está gravando valores vazio não?

Em seg., 12 de set. de 2022 às 15:28, LeoReAlert @.***> escreveu:

está retornando um erro aqui ao adicionar a fatura que não sei bem como resolver peço ajuda ? Está exibindo um erro aqui nas seguintes linhas:

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 65

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 73

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 75

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 76

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 77

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 78

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 79

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 80

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 81

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 82

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 83

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\faturas\Gerenciador-financeiro-master\modulos\faturas\form.php on line 84

— Reply to this email directly, view it on GitHub https://github.com/gabriela-castro/Gerenciador-financeiro/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3DRGF5ZWHOT3MCCFTJKZLV55Y3VANCNFSM6AAAAAAQKXEE2U . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Aldy Salvino de Oliveira E-mail: @.** Skype: aldy_salvino Fone:* 19 - 98183 7773

LeoReAlert commented 1 year ago

https://github.com/gabriela-castro/Gerenciador-financeiro/issues/25#issuecomment-1245729441

Sim os valores estão vazios nas tabelas no banco só criei os bancos

eu consegui resolver os erros usando foreach mais quando salvo a fatura da um erro na key Esse erro aqui !! Warning: Undefined array key 1 in C:\xampp\htdocs\cgsistema\Gerenciador-financeiro-master\config\funcoes.php on line 319

AldySalvino commented 1 year ago

se não têm valores vai dá erro mesmo

Em ter., 13 de set. de 2022 às 17:02, LeoReAlert @.***> escreveu:

25 (comment)

https://github.com/gabriela-castro/Gerenciador-financeiro/issues/25#issuecomment-1245729441

Sim os valores estão vazios nas tabelas no banco só criei os bancos

eu consegui resolver os erros usando foreach mais quando salvo a fatura da um erro na key Esse erro aqui !! Warning: Undefined array key 1 in C:\xampp\htdocs\cgsistema\Gerenciador-financeiro-master\config\funcoes.php on line 319

— Reply to this email directly, view it on GitHub https://github.com/gabriela-castro/Gerenciador-financeiro/issues/25#issuecomment-1245896202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3DRGBSNFFYULABBUY2343V6DMWPANCNFSM6AAAAAAQKXEE2U . You are receiving this because you commented.Message ID: @.***>

-- Aldy Salvino de Oliveira E-mail: @.** Skype: aldy_salvino Fone:* 19 - 98183 7773

LeoReAlert commented 1 year ago

ah sim entendi

LeoReAlert commented 1 year ago

vou tentar aqui

AldySalvino commented 1 year ago

vc precisa inserir os dados no sistema para gerar a fatura

Em ter., 13 de set. de 2022 às 17:21, LeoReAlert @.***> escreveu:

vou tentar aqui

— Reply to this email directly, view it on GitHub https://github.com/gabriela-castro/Gerenciador-financeiro/issues/25#issuecomment-1245915241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3DRGEWNP4EBQPDQNN63K3V6DO3HANCNFSM6AAAAAAQKXEE2U . You are receiving this because you commented.Message ID: @.***>

-- Aldy Salvino de Oliveira E-mail: @.** Skype: aldy_salvino Fone:* 19 - 98183 7773

LeoReAlert commented 1 year ago

Sim vou fazer o teste, então esse erro é por causa da colunas que estão vazias ?
porque pensei que fosse a ARRAY hehehe

Warning: Undefined array key 1 in C:\xampp\htdocs\cgsistema\Gerenciador-financeiro-master\config\funcoes.php on line 319

LeoReAlert commented 1 year ago

esse erro é aprensentado ao tentar editar a fatura após inserir os dados: Warning: Undefined array key "id_sFervico2" in C:\xampp\htdocs\cgsistema\Gerenciador-financeiro-master\modulos\faturas\form.php on line 84

LeoReAlert commented 1 year ago

consegui resolver aqui deu certo !! Estava dando erro por causa do valor que estava = [1] Linha 319 $hora = $array[0];

muito obrigado pela ajuda!!