/**
  * @covers Acc_Parm_Code::load
  * @todo   Implement testLoad().
  */
 public function testLoad()
 {
     $this->object->load();
     $this->object->p_code = 'CAISSE';
     $this->object->load();
     $this->assertTrue(TRUE);
 }
Exemplo n.º 2
0
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_ihidden.php';
require_once NOALYSS_INCLUDE . '/class_acc_parm_code.php';
echo '<div class="content">';
$gDossier = dossier::id();
//-----------------------------------------------------
// confirm mod
if (isset($_POST['confirm_mod'])) {
    extract($_POST);
    $update = new Acc_Parm_Code($cn, $p_code);
    $update->p_comment = $p_comment;
    $update->p_value = $p_value;
    $update->save();
}
$object = new Acc_Parm_Code($cn);
$all = $object->load_all();
echo '<div style="float:left; ">';
echo '<table align="left">';
for ($i = 0; $i < sizeof($all); $i++) {
    echo '<TR>';
    echo $all[$i]->display();
    echo '<TD><FORM method="POST">';
    $w = new IHidden();
    $w->name = 'id';
    $w->value = $i;
    echo $w->input();
    echo HtmlInput::submit('mod', 'modifie');
    echo '</FORM>';
    echo '</TD>';
    echo "</TR>";
Exemplo n.º 3
0
 function VatListing($p_year)
 {
     $cond_sql = " and   A.j_date = B.j_date and extract(year from A.j_date) ='{$p_year}'";
     /* List of customer  */
     $aCustomer = $this->cn->get_array('select f_id,name,quick_code,tva_num,poste_comptable from vw_client ' . " where tva_num !='' ");
     /* Use the code */
     // BASE ACCOUNT
     // for belgium
     $s = new Acc_Parm_Code($this->cn, 'VENTE');
     $s->load();
     $SOLD = $s->p_value;
     $c = new Acc_Parm_Code($this->cn, 'CUSTOMER');
     $c->load();
     $CUSTOMER = $c->p_value;
     $t = new Acc_Parm_Code($this->cn, 'COMPTE_TVA');
     $t->load();
     $TVA = $t->p_value;
     $a_Res = array();
     /* for each customer compute VAT, Amount...*/
     foreach ($aCustomer as $l) {
         // Seek the customer
         //---
         $customer = $l['quick_code'];
         $a_Res[$customer]['name'] = $l['name'];
         $a_Res[$customer]['vat_number'] = $l['tva_num'];
         $a_Res[$customer]['amount'] = 0;
         $a_Res[$customer]['tva'] = 0;
         $a_Res[$customer]['poste_comptable'] = $l['poste_comptable'];
         /* retrieve only operation of sold and vat */
         // Get all the sell operation
         //----
         $sql = "select distinct j_grpt\n                 from\n                 jrnx as A\n                 join jrnx as B using (j_grpt)\n                 where\n                 A.j_qcode = '" . $l['quick_code'] . "' and\n                 B.j_poste::text like '" . $SOLD . "%'\n                 {$cond_sql}\n                 ";
         $Res = $this->cn->exec_sql($sql);
         // Foreach operation
         // where 7% or tva account are involved
         // and store the result in an array (a_Res)
         //---
         for ($i = 0; $i < Database::num_row($Res); $i++) {
             // Get each row
             //---
             $row1 = Database::fetch_array($Res, $i);
             // select the operation
             //----
             $Res2 = $this->cn->exec_sql("select j_poste,j_montant,j_debit from jrnx where j_grpt=" . $row1['j_grpt']);
             $a_row = Database::fetch_all($Res2);
             // Store the amount in the array
             //---
             foreach ($a_row as $e) {
                 $amount = 0;
                 $tva = 0;
                 if (substr($e['j_poste'], 0, strlen($SOLD)) === $SOLD) {
                     $amount = $e['j_debit'] == 'f' ? $e['j_montant'] : $e['j_montant'] * -1;
                 }
                 if (substr($e['j_poste'], 0, strlen($TVA)) === $TVA) {
                     $tva = $e['j_debit'] == 'f' ? $e['j_montant'] : $e['j_montant'] * -1;
                 }
                 // store sold
                 //---
                 $a_Res[$customer]['amount'] = isset($a_Res[$customer]['amount']) ? $a_Res[$customer]['amount'] : 0;
                 $a_Res[$customer]['amount'] += $amount;
                 // store vat
                 //---
                 $a_Res[$customer]['tva'] = isset($a_Res[$customer]['tva']) ? $a_Res[$customer]['tva'] : 0;
                 $a_Res[$customer]['tva'] += $tva;
                 // store customef info
                 //---
                 $a_Res[$customer]['customer'] = $customer;
             }
         }
         // foreach $a
     }
     // foreach ( customer)
     return $a_Res;
 }