$row->purchase_date = format_date(date("Y-m-d"));
         $row->item_id = false;
         $row->purchase_price = false;
         $row->purchase_qty = false;
         $row->purchase_total = false;
         $row->supplier_id = false;
         $row->branch_id = false;
         $row->purchase_payment_type = false;
         $row->purchase_code = false;
         $row->purchase_id = false;
         $action = "purchase.php?page=save";
     }
     $query_item = select_detail($id, $_SESSION['user_id']);
     $query_item2 = select_detail($id, $_SESSION['user_id']);
     $query_item3 = select_detail($id, $_SESSION['user_id']);
     $query_item4 = select_detail($id, $_SESSION['user_id']);
     include '../views/purchase/form.php';
     get_footer();
     break;
 case 'save':
     extract($_POST);
     $i_date = get_isset($i_date);
     $i_date = format_back_date($i_date);
     //$i_item_id = get_isset($i_item_id);
     //$i_harga = get_isset($i_harga);
     //$i_qty = get_isset($i_qty);
     //$i_total = get_isset($i_total);
     $i_supplier = get_isset($i_supplier);
     $i_branch_id = get_isset($i_branch_id);
     $i_payment_type = get_isset($i_payment_type);
     if ($i_payment_type == 1) {
     break;
 case 'download_tagihan':
     $i_date = $_GET['date'];
     $i_date = str_replace(" ", "", $i_date);
     $date_real = $_GET['date'];
     $date = explode("-", $i_date);
     $date1 = format_back_date($date[0]);
     $date2 = format_back_date($date[1]);
     $i_owner_id = get_isset($_GET['owner']);
     if ($i_owner_id == 0) {
         $supplier = "All Supplier";
     } else {
         $supplier = get_data_owner($i_owner_id);
     }
     $transport_service_komulatif = get_transport_service_komulatif();
     $query_item = select_detail($date1, $date2, $i_owner_id);
     //fungsi backup
     $datetime1 = new DateTime($date1);
     $datetime2 = new DateTime($date2);
     $difference = $datetime1->diff($datetime2);
     //echo $difference->days;
     /*$sel = abs(strtotime($date2)-strtotime($date1));
     		$selisih= $sel /(60*60*24);*/
     $jumlah_hari = $difference->days + 1;
     $jumlah_truk = get_jumlah_truk($date1, $date2, $i_owner_id);
     $jumlah_pengiriman = get_jumlah_pengiriman($date1, $date2, $i_owner_id);
     $jumlah_volume = get_jumlah_volume($date1, $date2, $i_owner_id) ? get_jumlah_volume($date1, $date2, $i_owner_id) : 0;
     $jumlah_volume = str_replace(".", ",", $jumlah_volume);
     $total_jasa_angkut = get_total_jasa_angkut($date1, $date2, $i_owner_id);
     $total_jasa_angkut = str_replace(".", ",", $total_jasa_angkut);
     $total_subsidi_tol = get_total_subsidi_tol($date1, $date2, $i_owner_id);