{"\n"}{strip}
{include file='reportsview/portlet_started_work_row_calc.tpl' scope='parent'}
"{$data_item->project|forcsv}"{chr(9)}
{if $show_project_details}
    "{$data_item->project_name|forcsv}"{chr(9)}
    "{$data_item->project_number|forcsv}"{chr(9)}
    "{$data_item->cost_centre_names|forcsv}"{chr(9)}
    "{$data_item->project_manager_name|forcsv}"{chr(9)}
    "{$data_item->project_manager_abbreviation|forcsv}"{chr(9)}
    "{$data_item->client_name|forcsv}"{chr(9)}
    "{$data_item->office_in_charge_name|forcsv}"{chr(9)}
    "{$data_item->project_phase_name|forcsv}"{chr(9)}
    "{$data_item->start_date->us_date()}"{chr(9)}
    "{$data_item->end_date->us_date()}"{chr(9)}
    "{$data_item->project_category_name|forcsv}"{chr(9)}
    "{$data_item->purpose|forcsv}"{chr(9)}
{/if}
{if $show_project_addi_details}
    {foreach item=field from=$addi_fields}{*
        *}{assign var='field_id' value=$field->field}{*
        *}{addiview_csv field=$field value=$data_item->$field_id item=$data_item}{chr(9)}{*
    *}{/foreach}
{/if}
{if $has_right_costs}
    {if $show_all_datespan}
        {isfloat value=$data_item->planned_fees_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->planned_fees}{chr(9)}
    {if $project_intern_extern}
        {if $show_all_datespan}
            {isfloat value=$data_item->planned_fees_external_prev}{chr(9)}
            "{$data_item->planned_fees_externallist_prev|forcsv}"{chr(9)}
        {/if}
        {isfloat value=$data_item->planned_fees_external}{chr(9)}
        "{$data_item->planned_fees_externallist|forcsv}"{chr(9)}
    {/if}
    {if $deduct_hon_decr_costs}
        {if $show_all_datespan}
            {isfloat value=$data_item->hon_decr_costs_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->hon_decr_costs}{chr(9)}
        {if $show_all_datespan}
            {isfloat value=$data_item->planned_fees_prev-$data_item->hon_decr_costs_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->planned_fees-$data_item->hon_decr_costs}{chr(9)}
    {/if}
{/if}
{if $has_right_costs && $show_budget}
    {*
        *}{if $data_item->planned_fees>0}{*
            *}{isfloat value=($data_item->budget_plan_costs/$data_item->planned_fees)*100}{*
        *}{else}{*
            *}--{*
        *}{/if}{*
    *}{chr(9)}
    {isfloat value=$data_item->budget_plan_costs}{chr(9)}
    {if $project_intern_extern}
        {isfloat value=$data_item->budget_plan_costs_external}{chr(9)}
    {/if}
{/if}
{if $has_right_costs && $show_cost_details}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_times_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_times_cost}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_travels_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_travels_cost}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_extras_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_extras_cost}{chr(9)}
{/if}
{if $has_right_costs}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_cost_internal_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_cost_internal}{chr(9)}
{/if}
{if $has_right_costs && $show_extexp_details}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_externalexpenses_charged_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_externalexpenses_charged_cost}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_externalexpenses_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_externalexpenses_cost}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_externalexpenses_planned_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_externalexpenses_planned_cost}{chr(9)}
    {if $show_categories}
        {$sum_categories=0}
        {foreach item=fee_category from=$fee_categories}
            {$category_id="total_externalexpenses_cost_`$fee_category->id`"}
            {$sum_categories=$sum_categories+$data_item->$category_id}
            {isfloat value=$data_item->$category_id}{chr(9)}
        {/foreach}
        {isfloat value=$sum_categories}{chr(9)}
        {isfloat value=$data_item->total_externalexpenses_cost-$sum_categories}{chr(9)}
    {/if}
{/if}
{if $has_right_costs}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_cost}{chr(9)}
{/if}
{if $has_right_costs && $show_fees_diff}
    {if $show_all_datespan}
        {isfloat value=$data_item->planned_fees_prev-$data_item->total_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->planned_fees-$data_item->total_cost}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->planned_fees_prev-$data_item->hon_decr_costs_prev-$data_item->total_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->planned_fees-$data_item->hon_decr_costs-$data_item->total_cost}{chr(9)}
{/if}
{if $show_hours}
    {if $show_all_datespan}
        {isfloat value=$data_item->fees_plan_hours_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->fees_plan_hours}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->budget_plan_hours_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->budget_plan_hours}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->budget_plan_hours_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->budget_plan_hours}{chr(9)}
    {if $show_all_datespan}
        {isfloat value=$data_item->total_times_hours_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->total_times_hours}{chr(9)}
    {if $show_calcexp}{* Aufwand - Abgerechnete Stunden *}
        {if $show_all_datespan}
            {isfloat value=$data_item->calcexp_times_hours_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->calcexp_times_hours}{chr(9)}
    {/if}
{/if}
{if $show_all_datespan}
    {isfloat value=$data_item->completion_level_prev*100}{chr(9)}
{/if}
{isfloat value=$data_item->completion_level*100}{chr(9)}
{if $has_right_costs}
    {if $show_all_datespan}
        {isfloat value=$completed_prev}{chr(9)}
    {/if}
    {isfloat value=$completed}{chr(9)}

    {isfloat value=$completed_diff_prev}{chr(9)}
    {isfloat value=$completed_diff}{chr(9)}

    {if $prognosis_prev eq '--'}
        --{chr(9)}
    {else}
        {isfloat value=$prognosis_prev}{chr(9)}
    {/if}
    {if $prognosis eq '--'}
        --{chr(9)}
    {else}
        {isfloat value=$prognosis}{chr(9)}
    {/if}
{/if}
{if $has_right_costs && ($show_budget || $show_budget_completed) && $show_fees_diff}
    {if $show_all_datespan}
        {isfloat value=$data_item->budget_plan_costs_prev-$data_item->total_cost_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->budget_plan_costs-$data_item->total_cost}{chr(9)}
{/if}
{if $has_right_costs && $show_budget_completed}
    {if $show_all_datespan}
        {isfloat value=$completed_budget_prev}{chr(9)}
    {/if}
    {isfloat value=$completed_budget}{chr(9)}
    {isfloat value=$completed_budget_diff_prev}{chr(9)}
    {isfloat value=$completed_budget_diff}{chr(9)}
    {if $prognosis_budget_prev eq '--'}
        --{chr(9)}
    {else}
        {isfloat value=$prognosis_budget_prev}{chr(9)}
    {/if}
    {if $prognosis_budget eq '--'}
        --{chr(9)}
    {else}
        {isfloat value=$prognosis_budget}{chr(9)}
    {/if}
{/if}
{if $has_right_costs}
    {if $show_all_datespan}
        {isfloat value=$work_in_hand_prev}{chr(9)}
    {/if}
    {isfloat value=$work_in_hand}{chr(9)}
{/if}
{if $has_right_costs && $show_fees}
    {if $show_all_datespan}{* Honorar gestellt *}
        {isfloat value=$data_item->fees_invoiced_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->fees_invoiced}{chr(9)}
        {if $show_feehist}
            {if $show_all_datespan}
                {isfloat value=$data_item->fees_invoiced_after_prev}{chr(9)}
            {/if}
            {isfloat value=$data_item->fees_invoiced_after}{chr(9)}
        {/if}
    {if $show_fees_finally_invoiced}
        {if $show_all_datespan}
            {isfloat value=$data_item->fees_invoiced_finally_invoiced_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->fees_invoiced_finally_invoiced}{chr(9)}
        {if $show_all_datespan}
            {isfloat value=$data_item->fees_invoiced_finally_invoiced_not_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->fees_invoiced_finally_invoiced_not}{chr(9)}
    {/if}
    {if $show_feehist}{* Honorar geplant *}
        {if $show_all_datespan}
            {isfloat value=$data_item->fees_planned_before_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->fees_planned_before}{chr(9)}
    {/if}
    {if $show_all_datespan}
        {isfloat value=$data_item->fees_planned_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->fees_planned}{chr(9)}
    {if $show_all_datespan}{* Honorar bezahlt *}
        {isfloat value=$data_item->fees_remited_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->fees_remited}{chr(9)}
    {if $show_feehist}
        {if $show_all_datespan}
            {isfloat value=$data_item->fees_remited_after_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->fees_remited_after}{chr(9)}
        {if $show_all_datespan}{* Honorar Abzug *}
            {isfloat value=$data_item->fees_deduction_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->fees_deduction}{chr(9)}
    {/if}
    {if $show_all_datespan}
        {isfloat value=$data_item->fees_invoiced_prev-$data_item->fees_remited_prev}{chr(9)}
    {/if}
    {isfloat value=$data_item->fees_invoiced-$data_item->fees_remited}{chr(9)}
    {if $show_feehist}
        {if $show_all_datespan}
            {isfloat value=$data_item->fees_invoiced_after_prev-$data_item->fees_remited_after_prev}{chr(9)}
        {/if}
        {isfloat value=$data_item->fees_invoiced_after-$data_item->fees_remited_after}{chr(9)}
    {/if}
    {if $show_all_datespan}
        {isfloat value=$completed_prev-$data_item->fees_invoiced_prev}{chr(9)}
    {/if}
    {isfloat value=$completed-$data_item->fees_invoiced}{chr(9)}
    {if $show_fees_to_remit}
        {if $show_all_datespan}
            {$a = $data_item->planned_fees_prev-$data_item->fees_invoiced_prev}
            {isfloat value=$a}{chr(9)}
        {/if}
        {$a = $data_item->planned_fees-$data_item->fees_invoiced}
        {isfloat value=$a}{chr(9)}
        {if $show_all_datespan}
            {$a = $data_item->total_cost_prev-$data_item->fees_invoiced_prev}
            {isfloat value=$a}{chr(9)}
        {/if}
        {$a = $data_item->total_cost-$data_item->fees_invoiced}
        {isfloat value=$a}{chr(9)}
    {/if}
    {if $show_actualcosts_comp}
        {$a = $data_item->total_times_cost-$data_item->total_times_cost_prev}
        {$b = $data_item->total_travels_cost-$data_item->total_travels_cost_prev}
        {$c = $data_item->total_extras_cost-$data_item->total_extras_cost_prev}
        {$d = $data_item->total_externalexpenses_cost-$data_item->total_externalexpenses_cost_prev}            
        {$e = $data_item->total_cost-$data_item->total_cost_prev}
        {isfloat value=$a}{chr(9)}
        {isfloat value=$b}{chr(9)}
        {isfloat value=$c}{chr(9)}
        {isfloat value=$d}{chr(9)}
        {isfloat value=$e}{chr(9)}
    {/if}
    {if $show_categories}
        {$sum_categories=0}
        {foreach item=fee_category from=$fee_categories}
            {$category_id="fees_invoiced_`$fee_category->id`"}
            {$sum_categories=$sum_categories+$data_item->$category_id}
            {isfloat value=$data_item->$category_id}{chr(9)}
        {/foreach}
        {isfloat value=$sum_categories}{chr(9)}
        {isfloat value=$data_item->fees_invoiced-$sum_categories}{chr(9)}
    {/if}
{/if}
{if $show_dates}
    {$data_item->last_times->us_date()}{chr(9)}
    {$data_item->last_completion_level->us_date()}{chr(9)}
{/if}
{if $show_calcexp}
    {$data_item->is_calc_from_expenses}{chr(9)}
        {if $show_project_details}
            "{if $data_item->is_calc_from_expenses && isset($data_item->project_category_rates->times_name)}{$data_item->project_category_rates->times_name|forcsv}{/if}"{chr(9)}
            "{if $data_item->is_calc_from_expenses && isset($data_item->project_category_rates->area_name)}{$data_item->project_category_rates->area_name|forcsv}{/if}"{chr(9)}
            "{if $data_item->is_calc_from_expenses && isset($data_item->project_category_rates->travel_name)}{$data_item->project_category_rates->travel_name|forcsv}{/if}"{chr(9)}
            "{if $data_item->is_calc_from_expenses && isset($data_item->project_category_rates->extra_name)}{$data_item->project_category_rates->extra_name|forcsv}{/if}"{chr(9)}
        {/if}
    {* ---- Datum ---- ---- ---- ---- *}
    {if $show_all_datespan}
        {$data_item->calcexp_lastdate_prev->us_date()}{chr(9)}
    {/if}
    {$data_item->calcexp_lastdate->us_date()}{chr(9)}
    {if $show_all_datespan}
        {$data_item->calcexp_loc_lastdate_prev->us_date()}{chr(9)}
    {/if}
    {$data_item->calcexp_loc_lastdate->us_date()}{chr(9)}
    {if $show_all_datespan}
        {$data_item->fees_invoiced_lastdate_prev->us_date()}{chr(9)}
    {/if}
    {$data_item->fees_invoiced_lastdate->us_date()}{chr(9)}
    {if $has_right_costs}
        {* ---- Aufwand ---- ---- ---- ---- *}
        {if !$show_calcexp_woa}
            {isfloat maxf=$maxf value=$data_item->calcexp_open_proj_curr}{chr(9)}
        {else}
            {isfloat maxf=$maxf value=$data_item->calcexp_open_woa_curr}{chr(9)}
        {/if}
        {if !$show_calcexp_woa}
            {if $show_all_datespan}
                {isfloat maxf=$maxf value=$data_item->calcexp_open_proj_prev}{chr(9)}
            {/if}
            {isfloat maxf=$maxf value=$data_item->calcexp_open_proj}{chr(9)}
            {if $show_all_datespan}
                {isfloat maxf=$maxf value=$data_item->calcexp_done_proj_prev}{chr(9)}
            {/if}
            {isfloat maxf=$maxf value=$data_item->calcexp_done_proj}{chr(9)}
        {else}
            {if $show_all_datespan}
                {isfloat maxf=$maxf value=$data_item->calcexp_open_woa_prev}{chr(9)}
            {/if}
            {isfloat maxf=$maxf value=$data_item->calcexp_open_woa}{chr(9)}
            {if $show_all_datespan}
                {isfloat maxf=$maxf value=$data_item->calcexp_done_woa_prev}{chr(9)}
            {/if}
            {isfloat maxf=$maxf value=$data_item->calcexp_done_woa}{chr(9)}
        {/if}
        {* ---- Honorarabr. ---- ---- ---- ---- *}
        {if $show_all_datespan}
            {isfloat maxf=$maxf value=$data_item->project_no_estim_offers_prev}{chr(9)}
        {/if}
        {isfloat maxf=$maxf value=$data_item->project_no_estim_offers}{chr(9)}
        {if $show_all_datespan}
            {isfloat maxf=$maxf value=$data_item->calcexp_loc_prev}{chr(9)}
        {/if}
        {isfloat maxf=$maxf value=$data_item->calcexp_loc}{chr(9)}
        {* ---- Gesamt ---- ---- ---- ---- *}
        {if $show_all_datespan}
            {isfloat maxf=$maxf value=$calcexp_done_prev}{chr(9)}
        {/if}
        {isfloat maxf=$maxf value=$calcexp_done}{chr(9)}
    {/if}
{/if}
{if $has_right_costs && $show_costcentres}
    {$sum_cs_fee_costs = 0}{$sum_cs_fee_costs_prev = 0}{$sum_cs_total_cost = 0}{$sum_cs_total_cost_prev = 0}
    {foreach item=cost_centre from=$cost_centres_list}
        {if $show_all_datespan}
            {$item_costs_id_prev="cs_planned_fees_`$cost_centre->id`_prev"}
            {$sum_cs_fee_costs_prev = $sum_cs_fee_costs_prev + $data_item->$item_costs_id_prev}
            {isfloat maxf=$maxf value=$data_item->$item_costs_id_prev}{chr(9)}
        {/if}
        {$item_costs_id="cs_planned_fees_`$cost_centre->id`"}
        {$sum_cs_fee_costs = $sum_cs_fee_costs + $data_item->$item_costs_id}
        {isfloat maxf=$maxf value=$data_item->$item_costs_id}{chr(9)}
        {if $show_all_datespan}
            {$item_costs_id_prev="cs_total_cost_`$cost_centre->id`_prev"}
            {$sum_cs_total_cost_prev = $sum_cs_total_cost_prev + $data_item->$item_costs_id_prev}
            {isfloat maxf=$maxf value=$data_item->$item_costs_id_prev}{chr(9)}
        {/if}
        {$item_costs_id="cs_total_cost_`$cost_centre->id`"}
        {$sum_cs_total_cost = $sum_cs_total_cost + $data_item->$item_costs_id}
        {isfloat maxf=$maxf value=$data_item->$item_costs_id}{chr(9)}
    {/foreach}
    {if $cost_centre@total>=1}
        {* Not in assigned cost centres *}
        {if $show_all_datespan}
            {isfloat maxf=$maxf value=$data_item->planned_fees_prev-$sum_cs_fee_costs_prev}{chr(9)}
        {/if}
        {isfloat maxf=$maxf value=$data_item->planned_fees-$sum_cs_fee_costs}{chr(9)}
        {if $show_all_datespan}
            {isfloat maxf=$maxf value=$data_item->total_cost_prev-$sum_cs_total_cost_prev}{chr(9)}
        {/if}
        {isfloat maxf=$maxf value=$data_item->total_cost-$sum_cs_total_cost}{chr(9)}
    {/if}
{/if}
{if $has_right_costs && $show_offers}
    {if $show_all_datespan}
        {isfloat maxf=$maxf value=$data_item->offers_offered_prev}{chr(9)}
    {/if}
    {isfloat maxf=$maxf value=$data_item->offers_offered}{chr(9)}
    {if $show_all_datespan}
        {isfloat maxf=$maxf value=$data_item->offers_ordered_prev}{chr(9)}
    {/if}
    {isfloat maxf=$maxf value=$data_item->offers_ordered}{chr(9)}
{/if}
{/strip}