[simpleinvoices commit] r1536 - in branches/nextrelease: . extensions/gene/include extensions/gene/templates/default/invo...

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 20, 2008, 7:27:38 AM3/20/08
to simpleinv...@googlegroups.com
Author: linuxppc
Date: Thu Mar 20 04:27:29 2008
New Revision: 1536

Modified:
branches/nextrelease/extensions/gene/include/sql_queries.php
branches/nextrelease/extensions/gene/templates/default/invoices/itemised.tpl
branches/nextrelease/index.php
branches/nextrelease/modules/invoices/save.php

Log:
extensions update

Modified: branches/nextrelease/extensions/gene/include/sql_queries.php
==============================================================================
--- branches/nextrelease/extensions/gene/include/sql_queries.php (original)
+++ branches/nextrelease/extensions/gene/include/sql_queries.php Thu
Mar 20 04:27:29 2008
@@ -2,19 +2,19 @@

class gene_invoice extends invoice {

-function
insertInvoiceItem($invoice_id,$quantity,$product_id,$tax_id,$description="",$unit_cost) {
+function
insertInvoiceItem($invoice_id,$quantity,$product_id,$tax_id,$description="",$unit_price) {

$tax = getTaxRate($tax_id);
- $product = getProduct($product_id);
+ //$product = getProduct($product_id);
//print_r($product);
$actual_tax = $tax['tax_percentage'] / 100 ;
- $total_invoice_item_tax = $product['unit_price'] * $actual_tax;
+ $total_invoice_item_tax = $unit_price * $actual_tax;
$tax_amount = $total_invoice_item_tax * $quantity;
- $total_invoice_item = $total_invoice_item_tax + $product['unit_price'] ;
+ $total_invoice_item = $total_invoice_item_tax + $unit_price ;
$total = $total_invoice_item * $quantity;
- $gross_total = $product['unit_price'] * $quantity;
+ $gross_total = $unit_price * $quantity;

- $sql = "INSERT INTO ".TB_PREFIX."invoice_items
(`invoice_id`,`quantity`,`product_id`,`unit_price`,`tax_id`,`tax`,`tax_amount`,`gross_total`,`description`,`total`,`unit_cost`)
VALUES ($invoice_id,$quantity,$product_id,$product[unit_price],'$tax[tax_id]',$tax[tax_percentage],$tax_amount,$gross_total,'$description',$total,$unit_cost)";
+ $sql = "INSERT INTO ".TB_PREFIX."invoice_items
(invoice_id,quantity,product_id,unit_price,tax_id,tax,tax_amount,gross_total,description,total)
VALUES ($invoice_id,$quantity,$product_id,$unit_price,'$tax[tax_id]',$tax[tax_percentage],$tax_amount,$gross_total,'$description',$total)";

//echo $sql;
return mysqlQuery($sql);

Modified: branches/nextrelease/extensions/gene/templates/default/invoices/itemised.tpl
==============================================================================
---
branches/nextrelease/extensions/gene/templates/default/invoices/itemised.tpl (original)
+++
branches/nextrelease/extensions/gene/templates/default/invoices/itemised.tpl
Thu Mar 20 04:27:29 2008
@@ -37,7 +37,7 @@
{$LANG.description}
</td>
<td class="details_screen">
- Line Cost
+ Unit Price
</td>
</tr>

@@ -61,8 +61,10 @@

</td>
<td>
- <input id="state{$smarty.section.line.index}" value=""></input>
+ <input id="state{$smarty.section.line.index}"
name="unit_price{$smarty.section.line.index}" size="7" value=""></input>
+ {*
-- <input type=text name="unit_cost{$smarty.section.line.index}" size="5"></td>
+ *}
</td>
</tr>


Modified: branches/nextrelease/index.php
==============================================================================
--- branches/nextrelease/index.php (original)
+++ branches/nextrelease/index.php Thu Mar 20 04:27:29 2008
@@ -116,43 +116,47 @@
* Include the php file for the requested page section - start
*/

-/*Local the requested php file for the module*/
-if(file_exists("./modules/$path.php"))
-{
- preg_match("/^[a-z|A-Z|_]+\/[a-z|A-Z|_]+/",$path,$res);
+ /*Local the requested php file for the module*/
+ preg_match("/^[a-z|A-Z|_]+\/[a-z|A-Z|_]+/",$path,$res);

- if(isset($res[0]) && $res[0] == $path)
- {
- $file = $path;
- }
-}
+ if(isset($res[0]) && $res[0] == $path)
+ {
+ $file = $path;
+ }
+
+ /*
+ * If extension is enabled load the extension php file for the module
+ * Note: this system is probably slow - if you got a better method
for handling extensions let me know
+ */
+ $extensionPHPFile = 0;
+ foreach($extension as $key=>$value)
+ {
+ /*
+ * If extension is enabled then continue and include the requested
file for that extension if it exists
+ */
+ if($value['enabled'] == "1")
+ {
+ //echo "Enabled:".$value['name']."<br><br>";
+ if(file_exists("./extensions/$value[name]/modules/$path.php")) {
+
+ preg_match("/^[a-z|A-Z|_]+\/[a-z|A-Z|_]+/",$path,$res);

-include_once("./modules/$file.php");
+ if(isset($res[0]) && $res[0] == $path) {
+ $file = $path;
+ }

-/*
-* If extension is enabled load the extension php file for the module
-* Note: this system is probably slow - if you got a better method for
handling extensions let me know
-*/
-foreach($extension as $key=>$value)
-{
- /*
- * If extension is enabled then continue and include the requested
file for that extension if it exists
- */
- if($value['enabled'] == "1")
- {
- //echo "Enabled:".$value['name']."<br><br>";
- if(file_exists("./extensions/$value[name]/modules/$path.php")) {
-
- preg_match("/^[a-z|A-Z|_]+\/[a-z|A-Z|_]+/",$path,$res);
-
- if(isset($res[0]) && $res[0] == $path) {
- $file = $path;
- }
-
- include_once("./extensions/$key[name]/modules/$file.php");
+ include_once("./extensions/$value[name]/modules/$file.php");
+ $extensionPHPFile++;
+ }
+ }
+ }
+ /*
+ * If no extension php file for requested file load the normal php
file if it exists
+ */
+ if( ($extensionPHPFile == 0) AND
(file_exists("./modules/$file.php")) )
+ {
+ include_once("./modules/$file.php");
}
- }
-}

/*
* Include the php file for the requested page section - end

Modified: branches/nextrelease/modules/invoices/save.php
==============================================================================
--- branches/nextrelease/modules/invoices/save.php (original)
+++ branches/nextrelease/modules/invoices/save.php Thu Mar 20 04:27:29 2008
@@ -60,9 +60,9 @@
/*
* If an extension has set an alternate class name use that - else
use the stardard class of invoice
*/
- $invoice_class_name =
empty($extension['invoice_class_name']) ? "invoice" : $extension['invoice_class_name'] ;
- $insertII = new $invoice_class_name;
- if
($insertII->insertInvoiceItem($invoice_id,$_POST["quantity$i"],$_POST["products$i"],$_POST['tax_id'],$_POST["description$i"],$_POST["unit_cost$i"])
) {
+ //$invoice_class_name =
empty($extension['invoice_class_name']) ? "invoice" : $extension['invoice_class_name'] ;
+ $insertII = new invoice;
+ if
($insertII->insertInvoiceItem($invoice_id,$_POST["quantity$i"],$_POST["products$i"],$_POST['tax_id'],$_POST["description$i"])
) {
//$saved = true;
} else {
die(mysql_error());

Reply all
Reply to author
Forward
0 new messages