Jump to content

A little Help


lindem

Recommended Posts

Hello.

 

I need to add the "$description" from the table "tplinvoiceitems" into the boleto.php. Does anyone to give a help with this?

 

The code is (boleto.php):

 

 

 

<?

include("../../../dbconnect.php");
include("../../../includes/functions.php");
include("../../../includes/clientfunctions.php");

$gwresult = mysql_query("SELECT * FROM tblpaymentgateways WHERE gateway='boleto' ORDER BY `id` ASC");
while($data = mysql_fetch_array($gwresult)) {
$gVgwsetting = $data["setting"];
$gVgwvalue = $data["value"];
$GATEWAY["$gVgwsetting"]="$gVgwvalue";
}

$query = "SELECT * FROM tblinvoices WHERE id='$invoiceid'";
$result=mysql_query($query);
$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 (($_SESSION["uid"]!=$userid)OR(!$id)) {
echo "Invalid Access Attempt";
exit;
}

$clientsdetails = getClientsDetails($userid);

$year = substr($duedate,0,4);
$month = substr($duedate,5,2);
$day = substr($duedate,8,2);

 

Regards.

Link to comment
Share on other sites

do you need just the first item or all items in the description (because one invoice may have multiple line items).

 

here is the query:

 

SELECT `description` FROM `tblinvoiceitems` WHERE `invoiceid`= '$invoiceid'

 

now depending on what your needs are, the code will vary.

Link to comment
Share on other sites

Let me explain the whole thing then...

 

 

<?

include("../../../dbconnect.php");
include("../../../includes/functions.php");
include("../../../includes/clientfunctions.php");

$gwresult = mysql_query("SELECT * FROM tblpaymentgateways WHERE gateway='boleto' ORDER BY `id` ASC");
while($data = mysql_fetch_array($gwresult)) {
$gVgwsetting = $data["setting"];
$gVgwvalue = $data["value"];
$GATEWAY["$gVgwsetting"]="$gVgwvalue";
}

$query = "SELECT * FROM tblinvoices WHERE id='$invoiceid'";
$result=mysql_query($query);
$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 (($_SESSION["uid"]!=$userid)OR(!$id)) {
echo "Invalid Access Attempt";
exit;
}

$clientsdetails = getClientsDetails($userid);

$year = substr($duedate,0,4);
$month = substr($duedate,5,2);
$day = substr($duedate,8,2);

$banco = $GATEWAY["banco"];

$dias_de_prazo_para_pagamento = 0; // No need for this, since the due date will be the same as the invoice's
$taxa_boleto = $GATEWAY["taxa"]; // FIELD NAME IN ADMIN: Taxa do boleto
$data_venc = date("d/m/Y",mktime(0,0,0,$month,$day,$year));  // It has to be the same as the invoice due date
$valor_cobrado = $total;
$valor_boleto=number_format($valor_cobrado+$taxa_boleto, 2, ',', '');

$dadosboleto["nosso_numero"] = $invoiceid;  // It's the variable nosso_numero for all banks
$dadosboleto["numero_documento"] = $invoiceid;
$dadosboleto["data_vencimento"] = $data_venc;
$dadosboleto["data_documento"] = date("d/m/Y");
$dadosboleto["data_processamento"] = date("d/m/Y");
$dadosboleto["valor_boleto"] = $valor_boleto;

// DADOS DO SEU CLIENTE
$dadosboleto["sacado"] = $clientsdetails["firstname"]." ".$clientsdetails["lastname"]; 
$dadosboleto["endereco1"] = $clientsdetails["address1"];
$dadosboleto["endereco2"] = $clientsdetails["city"].", ".$clientsdetails["state"].", ".$clientsdetails["postcode"]; 

// INFORMACOES PARA O CLIENTE
// The information below needs to be configurable in the admin, it's some optional information for client's receipt (top portion of the boleto and intructions for cashier in the boleto itself.
$dadosboleto["demonstrativo1"] = $description;   // FIELD DESCRIPTION: Linha 1 do Recibo do Sacado
$dadosboleto["demonstrativo2"] = "Mensalidade referente a nonon nonooon nononon";   // FIELD DESCRIPTION: Linha 2 do Recibo do Sacado


?>

 

And I need to make the description of the invoice appears where is:

 

$dadosboleto["demonstrativo1"] = $description;

 

Many thanks for your help trine!

Link to comment
Share on other sites

lindem,

 

again, do you need only 1 item description or all.

 

for the first match only:

$query = "SELECT `description` FROM `tblinvoiceitems` WHERE invoiceid= '$invoiceid' LIMIT 1";

$result = mysql_query($query);

$data = mysql_fetch_array($result);

$description .= $data["description"];

 

for all matches:

 

$query = "SELECT `description` FROM `tblinvoiceitems` WHERE `invoiceid`= '$invoiceid'";

$result = mysql_query($query);

while ($data = mysql_fetch_array($result)){

$description .= $data["description"] . ", ";

}

$description = trim($description);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated