<?php

function display_payroll_run_header_details($payroll_run_id, $db_name) {
    $payroll = view_payroll_run_details($payroll_run_id, $db_name);
	 	 	 	 	 	 	 	 	 	
    start_table(TABLESTYLE, "width=50%");
        label_cells("Payroll Name", $payroll['payroll_name'], "class='tableheader2'", "width=200px");
        end_row();
        start_row();  
        label_cells("Description", $payroll['description'], "class='tableheader2'", "width=200px");
        end_row();
        start_row();
        label_cells("Period Start Date", sql2date($payroll['period_start_date']), "class='tableheader2'", "width=200px");
        end_row();
        start_row();
        label_cells("Period End Date", sql2date($payroll['period_end_date']), "class='tableheader2'", "width=200px");
        end_row();
        start_row();
        label_cells("Transaction Date", sql2date($payroll['tran_date']), "class='tableheader2'", "width=200px");
        end_row();
        start_row();
        $link_id = '';
        if($payroll["linked_payroll_run_id"] > 0){
            $link_id = get_payroll_trans_view_str(ST_PAYROLL, $payroll["linked_payroll_run_id"], "", false, '', '', $db_name);
        }
        label_cells("Linked Payroll Run", $link_id, "class='tableheader2'", "width=200px");
        end_row();
        start_row();  
        label_cells("Status", $payroll['payroll_run_status_name'], "class='tableheader2'", "width=200px");
        end_row();
        start_row();  
        label_cells("Run By", $payroll['real_name'], "class='tableheader2'", "width=200px");
        end_row();
        start_row();  
        label_cells("Run Started Time", $payroll['start_time'], "class='tableheader2'", "width=200px");
        end_row();
        start_row();  
        label_cells("Run Completed Time", $payroll['end_time'], "class='tableheader2'", "width=200px");
        end_row();
        start_row();  
        label_cells("Last Completed Employee", $payroll['last_completed_employee_code'], "class='tableheader2'", "width=200px");
        end_row();

    end_table(2);  
    
    return $payroll;
}

function display_payroll_run_summary_details($payroll_run_id, $payroll_run) {               
    display_heading("Payroll Summary");
    start_table(TABLESTYLE, "width=50%");

	$th = array(_("ID"), _("Process Code"), _("Process Name"), _("Amount"), _(""));

        table_header($th);
        
        $k = $j = 0; //row colour counter

        $result = select_payroll_run_summary($payroll_run_id);
            while ($myrow = db_fetch($result)) {
                alt_table_row_color($k);

                    label_cell($myrow["id"]);
                    label_cell($myrow["component"]);
                    label_cell($myrow["process_name"]);   
                        $dec = 2;       

                    qty_cell($myrow["value"], false, $dec);

                    $comment = "";
                    if($payroll_run['status'] == "R" && is_numeric($myrow['comment'])){
                        $comment = get_gl_view_str(ST_PAYROLL, $payroll_run['id']);
                    }

                    label_cell($comment, 'align=center');

                end_row();

            } 

    end_table(2);
}

?>