<?php

function dashboard_view_transport_petty_cash_expenses($vehicle_id, $from_date, $to_date, $expense_type_id=0) {
    
    global $approval_statuses;
    

        display_heading('Transport Petty Cash Expenses');    br();
        
        $project_name = get_vehicle_formatted_name($vehicle_id);
        display_heading("Vehicle : ".$project_name);    br();
        
        if($expense_type_id > 0){
            $expense_type = get_list_value($expense_type_id);
            display_heading("Expense Type : ".$expense_type['value_name']);    br();
        }
        
        start_table(TABLESTYLE, "width=60%");

            $th = array("Date", "Batch No", "Float", "Approval Status", "Amount"); 
            
                table_header($th);
                
                    $k = $total_amount = $count = 0;
                    $result = view_dashboard_transport_petty_cash_expenses_details($vehicle_id, $from_date, $to_date,$expense_type_id);
                        while($row = db_fetch($result)) {
                            alt_table_row_color($k);
                                label_cell(sql2date($row['tran_date']),"align=center");
                                $link = get_petty_cash_trans_view_str(ST_I_OWE_YOU_BATCH, $row['batch_no']);
                                label_cell($link, "align=center");
                                label_cell($row["float_name"],"align=center");
                                label_cell($approval_statuses[$row["approval_status"]],"align=center");
                                
                                $total = $row['total'];
                                amount_cell($total);
                                
                                
\
                            end_row();

                            $total_amount += $total;
                            $count++;
                        }
                        
                        start_row();
                            label_cell(text_bold("Total"),"align=right colspan=4");
                            label_cell(text_bold(number_format($total_amount, 2)),"align=right"); 
                        end_row();
                
        end_table(2);
}


?>