コード例 #1
0
 function save_form_plan($p_array, $p_item, $p_j_id)
 {
     extract($p_array);
     if (!isset($hplan)) {
         return;
     }
     /* variable for in array
           pa_id array of existing pa_id
           hplan double array with the pa_id (column)
           val double array by row with amount
           op contains sequence
           p_item is used to identify what op is concerned
        */
     /* echo "j_id = $j_id p_item = $p_item hplan=".var_export($hplan[$p_item],true)." val = ".var_export($val[$p_item],true).'<br>'; */
     /* for each row */
     //   for ($i=0;$i<count($val[$p_item]);$i++) {
     $idx_pa_id = 0;
     $row = 0;
     // foreach col PA
     for ($e = 0; $e < count($hplan[$p_item]); $e++) {
         if ($idx_pa_id == count($pa_id)) {
             $idx_pa_id = 0;
             $row++;
         }
         if ($hplan[$p_item][$e] != -1 && $val[$p_item][$row] != '') {
             $op = new Anc_Operation($this->db);
             $op->po_id = $hplan[$p_item][$e];
             $op->oa_group = $this->oa_group;
             $op->j_id = $p_j_id;
             $op->oa_amount = $val[$p_item][$row];
             $op->oa_debit = $this->oa_debit;
             $op->oa_date = $this->oa_date;
             $op->oa_description = $this->oa_description;
             $op->oa_row = $row;
             $op->add();
         }
         $idx_pa_id++;
     }
     // }
 }