Commit 9954e9c4 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Several fixes to invoice module.

- fix currency symbol (euro)
- fix invoice tabs
- fix overviews and layout
- fix links to project
parent 09561e2f
......@@ -40,7 +40,18 @@ foreach ($temp_billed as $task_log)
$billed .= $task_log . ', ';
if (!empty($billed))
$billed = '(' . substr($billed, 0, -2) . ')';
$q->clear();
$q->addQuery('invoice_tag, invoice_status');
$q->addTable('invoice');
$q->addWhere('invoice_id = ' . $invoice_id);
$ptrc = $q->exec();
$nums=db_num_rows($ptrc);
echo db_error();
for ($x=0; $x < $nums; $x++) {
$row = db_fetch_assoc( $ptrc );
$invoice_tag = $row["invoice_tag"];
$invoice_status = $row["invoice_status"];
}
$q->clear();
$q->addQuery('
task_log.task_log_id as task_log_id,
......@@ -188,11 +199,11 @@ if ($a["task_amount"] == "0") {
$s .= '<td nowrap="nowrap" align=center>'.$username["contact_first_name"].' '.$username["contact_last_name"].'</td>';
$s .= '<td nowrap="nowrap" align=center>'.$tasks["task_log_hours"].'</td>';
$s .= '<td nowrap="nowrap">'.$costdesc.'</td>';
$s .= '<td nowrap="nowarap">' . dPgetConfig('currency_symbol').$amount.'</td>';
$s .= '<td nowrap="nowarap">' . dPgetConfig('currency_symbol') . '&nbsp;' . $amount.'</td>';
$s .= '</tr>';
$s .= '<tr>';
$s .= '<td colspan="2">&nbsp;</td>';
$s .= '<td colspan="5">';
$s .= '<td colspan="6">';
$s .= $tasks["task_log_description"];
$s .= '</td>';
$s .= "</tr>\n";
......@@ -234,7 +245,7 @@ $date = new CDate($a['task_log_date']);
<td nowrap>'.$username["contact_first_name"].' '.$username["contact_last_name"].'</td>
<td nowrap>'.$a['task_log_hours'].'</td>
<td nowrap>'.$a['billingcode_name'].'</td>
<td align="right" nowrap="nowrap">$<input type="text" name="fixed_'.$a['task_log_id'].'" size="6">
<td align="right" nowrap="nowrap">'.dPgetConfig('currency_symbol').'&nbsp; <input type="text" name="fixed_'.$a['task_log_id'].'" size="6">
</tr>
';
if (trim($check['task_invoice']) == '')
......@@ -346,6 +357,16 @@ Invoices will not be editable once the status changes from Open for Editing.
</td>
</tr>
<tr valign="top" width="90%">
<td align="right">Invoice Number&nbsp;
<?php echo $invoice_id?>
</td>
</tr>
<tr valign="top" width="90%">
<td align="right">Invoice Tag&nbsp;
<input type="text" name="tag" value="<?php echo $invoice_tag;?>" class="text" />
</td>
</tr>
<tr valign="top" width="90%">
<td align="right">Invoice Status&nbsp;
<select name="stat" size="1" class="text">
<option value="0">Open for Editing</option>
......@@ -389,8 +410,11 @@ for ($s=0; $s < count($tasks); $s++) {
}
?>
<tr>
<td colspan=6 align=right><b>Total</b></td>
<td>$<?php echo $myamount ?></td>
<td colspan=7 align=right><b>Total</b></td>
<td>
<?php echo dPgetConfig('currency_symbol'); ?>&nbsp;
<?php echo $myamount ?>
</td>
</tr>
</table>
......@@ -401,6 +425,7 @@ for ($s=0; $s < count($tasks); $s++) {
<input type="hidden" name="invoice_project" value="<?php echo $project_id;?>" />
<input type="hidden" name="project_id" value="<?php echo $project_id;?>" />
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id;?>" />
<input type="hidden" name="tag" value="<?php echo $invoice_tag;?>" />
<input type="hidden" name="task_invoice" value="<?php echo $invoice_id;?>" />
<input type="hidden" name="project_creator" value="<?php echo $AppUI->user_id;?>" />
<td align="right" nowrap="nowrap"><?php echo $AppUI->_('Start Date');?>
......@@ -427,7 +452,8 @@ for ($s=0; $s < count($tasks); $s++) {
<form name="changeMe" action="./index.php?m=invoice&a=addedit" method="post">
<input type="hidden" name="invoice_project" value="<?php echo $project_id;?>" />
<input type="hidden" name="project_id" value="<?php echo $project_id;?>" />
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id;?>" />
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id;?>" />
<input type="hidden" name="tag" value="<?php echo $invoice_tag;?>" />
<input type="hidden" name="task_invoice" value="<?php echo $invoice_id;?>" />
<input type="hidden" name="project_creator" value="<?php echo $AppUI->user_id;?>" />
<tr>
......@@ -461,7 +487,8 @@ if (isset($_POST['start_date']))
<th nowrap="nowrap"><?php echo $AppUI->_('Fixed Amount');?></th>
</tr>
<form name="editFrm" action="./index.php?m=invoice" method="post">
<input type="hidden" name="dosql" value="do_invoice_aed" />
<input type="hidden" name="dosql" value="do_invoice_aed" />
<input type="hidden" name="tag" value="<?php echo $invoice_tag;?>" />
<input type="hidden" name="invoice_project" value="<?php echo $project_id;?>" />
<input type="hidden" name="task_invoice" value="<?php echo $invoice_id;?>" />
<input type="hidden" name="project_creator" value="<?php echo $AppUI->user_id;?>" />
......
<?php
$del = isset($_POST['del']) ? $_POST['del'] : 0;
$stat = isset($_POST['stat']) ? $_POST['stat'] : -1;
$stat = isset($_POST['stat']) ? $_POST['stat'] : -1;
$tag = isset($_POST['tag']) ? $_POST['tag'] : -1;
$obj = new CInvoice();
......@@ -25,6 +25,11 @@ if ($del) {
$AppUI->setMsg( $msg, UI_MSG_ERROR );
} else {
$AppUI->setMsg( $msg . "updated", UI_MSG_OK, true );
}
if (($msg = $obj->change_invoice_tag($tag))) {
$AppUI->setMsg( $msg, UI_MSG_ERROR );
} else {
$AppUI->setMsg( $msg . "updated", UI_MSG_OK, true );
}
$AppUI->redirect("m=invoice&a=addedit&invoice_id=".$obj->task_invoice."&project_id=".$obj->_invoice_project);
} else {
......
......@@ -15,7 +15,8 @@ $active = intval( !$AppUI->getState( 'InvoiceIdxTab' ) );
$q = new DBQuery;
$q->addQuery('
invoice_id,
invoice_id,
invoice_tag,
invoice_project,
invoice_status,
invoice_date,
......
......@@ -40,9 +40,7 @@ class CInvoice extends CDpObject {
$msg = $this->check();
$q = new DBQuery;
$q->addTable('invoice_task_queue');
$q->addInsert('task_invoice,task_amount,task_log_id',
$this->task_invoice.','.$this->task_amount.','.$this->task_log_id,
true);
$q->addInsert('task_invoice,task_amount,task_log_id', $this->task_invoice.','.$this->task_amount.','.$this->task_log_id, true);
$q->exec();
//db_insertObject('invoice_task_queue',$this,'task_queue_id');
......@@ -104,4 +102,14 @@ class CInvoice extends CDpObject {
$q->addWhere('invoice_id = ' . $this->task_invoice);
$q->exec();
}
function change_invoice_tag($tag)
{
$this->_action='updated';
$q = new DBQuery;
$q->addTable('invoice');
$q->addUpdate('invoice_tag', $tag);
$q->addWhere('invoice_id = ' . $this->task_invoice);
$q->exec();
}
}
......@@ -14,7 +14,8 @@ $tab = $AppUI->getState( 'ProjVwTab' ) !== NULL ? $AppUI->getState( 'ProjVwTab'
$q = new DBQuery;
$q->addQuery('
invoice_id,
invoice_id,
invoice_tag,
invoice_project,
invoice_status,
invoice_date,
......@@ -72,7 +73,8 @@ $q->addWhere('user_id = ' . $a['invoice_creator']);
$s .= "\n\t</td>";
// name link
$alt = htmlspecialchars( $a["invoice_id"] );
$s .= '<td align=right>&nbsp;<a href="./index.php?m=invoice&a=view&invoice_id='.$a["invoice_id"].'&project_id='.$project_id.'" title="' . $alt . '"># ' . $a["invoice_id"] . '</a></td>';
$s .= '<td align=right>&nbsp;<a href="./index.php?m=invoice&a=view&invoice_id='.$a["invoice_id"].'&project_id='.$project_id.'" title="' . $alt . '"># ' . $a["invoice_id"] . '</a></td>';
$s .= '<td align=right>&nbsp;<a href="./index.php?m=invoice&a=view&invoice_id='.$a["invoice_id"].'&project_id='.$project_id.'" title="' . $alt . '">' . $a["invoice_tag"] . '</a></td>';
// task owner
$s .= '<td nowrap="nowrap" align=center>'.$username["contact_first_name"].' '.$username["contact_last_name"].'</td>';
// start date
......@@ -98,6 +100,7 @@ if ($perms->checkModule('invoice', 'add'))
<tr>
<th width="10">&nbsp;</th>
<th width="250"><?php echo $AppUI->_('Invoice Number');?></th>
<th width="250"><?php echo $AppUI->_('Invoice Tag');?></th>
<th nowrap="nowrap"><?php echo $AppUI->_('Invoice Creator');?></th>
<th width="100" nowrap="nowrap"><?php echo $AppUI->_('Creation Date');?></th>
<th width="100" nowrap="nowrap"><?php echo $AppUI->_('Invoive Status');?></th>
......
......@@ -29,6 +29,7 @@ class CSetupInvoice{
function install() {
$sql = "(
`invoice_id` bigint(20) NOT NULL auto_increment,
`invoice_tag` char(10) NOT NULL unique,
`invoice_project` int(11) NOT NULL default '0',
`invoice_status` int(4) NOT NULL default '0',
`invoice_date` int(11) NOT NULL default '0',
......
......@@ -172,7 +172,7 @@ if ($a["task_amount"] == "0") {
$s .= '<td nowrap="nowrap" align=center>'.$username["contact_first_name"].' '.$username["contact_last_name"].'</td>';
$s .= '<td nowrap="nowrap" align=center>'.$tasks["task_log_hours"].'</td>';
$s .= '<td nowrap="nowrap"> '.$costdesc.'</td>';
$s .= '<td nowrap="nowrap">'.dPgetConfig('currency_symbol').$amount.'</td>';
$s .= '<td nowrap="nowrap">'.dPgetConfig('currency_symbol').'&nbsp;'.$amount.'</td>';
$s .= '</tr>';
$s .= '<tr>';
$s .= '<td colspan="1">&nbsp;</td>';
......@@ -243,7 +243,7 @@ for ($s=0; $s < count($tasks); $s++) {
if (!empty($bcodes))
foreach ($bcodes as $code=>$rate)
$temp[] = sprintf("%.2f", round($hours[strtolower($code)] - $tmp[strtolower($code)], 2));
$temp[] = dPgetConfig('currency_symbol') . sprintf("%.2f", round($amount_fixed - $tmpfix, 2));
$temp[] = dPgetConfig('currency_symbol') . sprintf(" %.2f", round($amount_fixed - $tmpfix, 2));
$pdfdata2t[] = array_merge($tmppdfdata2, $temp);
}
......@@ -293,7 +293,11 @@ $tasks=db_fetch_assoc($tmptasks);
?>
<tr>
<td colspan=5 align=right><b>Total</b></td>
<td>$<?php echo $myamount ?></td>
<td>
<?php echo dPgetConfig('currency_symbol'); ?>
&nbsp;
<?php echo $myamount ?>
</td>
</tr>
</table>
......
......@@ -10,6 +10,9 @@ $df = $AppUI->getPref('SHDATEFORMAT');
<th nowrap="nowrap">
<a href="?m=invoice&orderby=invoice_id" class="hdr"><?php echo $AppUI->_('Invoice Number');?></a>
</th>
<th nowrap="nowrap">
<a href="?m=invoice&orderby=invoice_tag" class="hdr"><?php echo $AppUI->_('Invoice Tag');?></a>
</th>
<th nowrap="nowrap">
<a href="?m=invoice&orderby=invoice_project" class="hdr"><?php echo $AppUI->_('Project');?></a>
</th>
......@@ -62,22 +65,23 @@ foreach ($invoices as $row)
$s .= '<a href="?m=invoice&a=addedit&invoice_id=' . $row['invoice_id'] . '&project_id=' . $row['invoice_project'] . '"><img src="./images/icons/pencil.gif" alt="'.$AppUI->_( 'Edit Invoice' ).'" border="0" width="12" height="12"></a>';
$s .= '&nbsp; </td>';
$s .= $CR . '<td nowrap="nowrap" width=100><a href="?m=invoice&a=view&project_id=' . $row["invoice_project"] . '&invoice_id=' . $row["invoice_id"] .'">#' . $row["invoice_id"] . '</a></td>';
$s .= $CR . '<td nowrap="nowrap" width=100><a href="?m=invoice&a=view&project_id=' . $row["invoice_project"] . '&invoice_id=' . $row["invoice_id"] .'">' . $row["invoice_tag"] . '</a></td>';
$s .= $CR . '<td width=500>';
$s .= $CT . '<a href="?m=projects&a=view&project_id=' . $row["invoice_project"] . '" title="' . $myproject_name[0]["project_description"] . '">' . $myproject_name[0]["project_name"] . '</a>';
$s .= $CR . '</td>';
$s .= $CR . '<td nowrap="nowrap">' .$myuser_name[0]["contact_first_name"]. ' '.$myuser_name[0]["contact_last_name"]. '</td>';
$s .= $CR . '<td nowrap="nowrap">' .$mydate. '</td>';
$s .= $CR . '<td nowrap="nowrap">'.dPgetConfig('currency_symbol') .$total_amount. '</td>';
$s .= $CR . '<td nowrap="nowrap">'.dPgetConfig('currency_symbol').'&nbsp;'.$total_amount. '</td>';
$s .= $CR . '</tr>';
echo $s;
}
}
if ($none) {
echo $CR . '<tr><td colspan="6">' . $AppUI->_( 'No open invoice available' ) . '</td></tr>';
echo $CR . '<tr><td colspan="7">' . $AppUI->_( 'No open invoice available' ) . '</td></tr>';
}
?>
<tr>
<td colspan="6">&nbsp;</td>
<td colspan="7">&nbsp;</td>
</tr>
</table>
<?php
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment