CarllosRA Posted June 11, 2018 Share Posted June 11, 2018 Salve galera, Alguém pode me dar uma luz no que pode estar errado no código abaixo, pois a data só atualiza se estiver com mais de 30 dias em atraso, menos que isso ela não atualiza. <?php include("../../../dbconnect.php"); include("../../../includes/functions.php"); include("../../../includes/clientfunctions.php"); include("../../../includes/invoicefunctions.php"); require("../../../init.php"); $whmcs->load_function('gateway'); $whmcs->load_function('client'); $GATEWAY = getGatewayVariables("boleto"); if (!$GATEWAY["type"]) die("Module Not Activated"); if ( !isset($_SESSION["uid"]) && !isset($_SESSION['adminid']) ) { redirSystemURL("", "clientarea.php"); } $GATEWAY = array(); $gwresult = select_query("tblpaymentgateways","",array("gateway"=>"boleto")); while ($data = mysql_fetch_array($gwresult)) { $gVgwsetting = $data["setting"]; $gVgwvalue = $data["value"]; $GATEWAY[$gVgwsetting] = $gVgwvalue; } if (!in_array($GATEWAY['banco'],array('cef'))) exit; $result = select_query("tblinvoices","",array("id"=>(int)$invoiceid)); $data = mysql_fetch_array($result); $id = $data["id"]; $userid = $data["userid"]; $date = $data["date"]; $duedate = $data["duedate"]; $subtotal = $data["subtotal"]; $credit = $data["credit"]; $tax = $data["tax"]; $taxrate = $data["taxrate"]; $total = $data["total"]; if ( $id && $userid && ( isset($_SESSION['adminid']) || $_SESSION["uid"]==$userid ) ) {} else { die("Invalid Access Attempt"); } $clientsdetails = getclientsDetails($data["userid"]); function Data($date){ $expdata = explode("-",$date); $date = $expdata[2]."/".$expdata[1]."/".$expdata[0]; return $date; } $year = substr($duedate,0,4); $month = substr($duedate,5,2); $day = substr($duedate,8,2); function MaisDias($day,$toadd) { $tmp = explode("/",$day); $dadate = mktime(0,0,0,$tmp[1],$tmp[0]+($toadd),$tmp[2]); return date('d/m/Y',$dadate); } $venc = date("d/m/Y",mktime(0,0,0,$month,$day,$year)); $venc = strtotime($venc); $today = date("d/m/Y"); $hoje = strtotime($today); if ($venc < $hoje){$data_venc = date("d/m/Y",mktime(0,0,0,$month,$day,$year)); } else {$venc = MaisDias($today,3); } //$data_venc = date("d/m/Y",mktime(0,0,0,$month,$day,$year)); // It has to be the same as the invoice due date //---------------------------------------- // DADOS DO BOLETO PARA O SEU CLIENTE $dias_de_prazo_para_pagamento = 0; $taxa_boleto = 6.30; //$data_venc = date("d/m/Y",mktime(0,0,0,$month,$day,$year)); $valor_cobrado = $total; $valor_cobrado = str_replace(",", ".",$valor_cobrado); $valor_boleto=number_format($valor_cobrado+$taxa_boleto, 2, ',', ''); // Composição Nosso Numero - CEF SIGCB $dadosboleto["nosso_numero1"] = "000"; // tamanho 3 $dadosboleto["nosso_numero_const1"] = "1"; //constanto 1 , 1=registrada , 2=sem registro $dadosboleto["nosso_numero2"] = "000"; // tamanho 3 $dadosboleto["nosso_numero_const2"] = "4"; //constanto 2 , 4=emitido pelo proprio cliente $dadosboleto["nosso_numero3"] = $invoiceid; // tamanho 9 $dadosboleto["numero_documento"] = $invoiceid; $dadosboleto["data_vencimento"] = $data_venc; $dadosboleto["data_documento"] = Data($data[date]); $dadosboleto["data_processamento"] = date("d/m/Y"); $dadosboleto["valor_boleto"] = $valor_boleto; 0 Quote Link to comment Share on other sites More sharing options...
msaulohenrique Posted June 12, 2018 Share Posted June 12, 2018 Creio que não precisa do include("../../../dbconnect.php"); include("../../../includes/functions.php"); include("../../../includes/clientfunctions.php"); include("../../../includes/invoicefunctions.php"); require("../../../init.php"); 0 Quote Link to comment Share on other sites More sharing options...
CarllosRA Posted June 12, 2018 Author Share Posted June 12, 2018 9 horas atrás, msaulohenrique disse: Creio que não precisa do include("../../../dbconnect.php"); include("../../../includes/functions.php"); include("../../../includes/clientfunctions.php"); include("../../../includes/invoicefunctions.php"); require("../../../init.php"); Olá @msaulohenrique, sem esses includes meu boleto não abre! mas valeu! 0 Quote Link to comment Share on other sites More sharing options...
Administration AngelCosta Posted June 12, 2018 Administration Share Posted June 12, 2018 15 horas atrás, CarllosRA disse: if ($venc < $hoje){$data_venc = date("d/m/Y",mktime(0,0,0,$month,$day,$year)); } else {$venc = MaisDias($today,3); } Sensação de que fui eu que escrevi esse código kkkk E se foi mesmo, acho que tem uma versão mais recente dele pegando o boleto atualizado usando o CPF/CNPJ. 1 Quote 'Cause he's my best friend, he's my pal. He's my homeboy, my rotten soldier. He's my sweet cheese. My good-time boy. Link to comment Share on other sites More sharing options...
CarllosRA Posted June 12, 2018 Author Share Posted June 12, 2018 @AngelCosta, kkkk somente a parte que altera a data, rssss, mas não está funcionando no meu código para gerar o boleto CEF SIGCB, alias funciona, só se o boleto estiver com mais de 30 dias de atraso. Eu vasculhei tudo aqui PDH e não achei, onde acho? 0 Quote Link to comment Share on other sites More sharing options...
Administration AngelCosta Posted June 12, 2018 Administration Share Posted June 12, 2018 Está no whmcs kit 0 Quote 'Cause he's my best friend, he's my pal. He's my homeboy, my rotten soldier. He's my sweet cheese. My good-time boy. Link to comment Share on other sites More sharing options...
CarllosRA Posted June 12, 2018 Author Share Posted June 12, 2018 @AngelCosta, foi desse kit que peguei o trecho do código, onde no qual só tem para Boleto CEF SINCO, ou meu é SIGCB, 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.