<?php

function sc_calculate_company_summary($calculation_id, $calculation_type, $month_id, $month_begin_date, $month_end_date)
{
    delete_monthly_summary_company($month_id);

  
        sc_calculate_monthly_company_receipts_summary($month_id,  
                                        $calculation_type, $calculation_id, $month_begin_date, $month_end_date);
        
        sc_calculate_monthly_company_payments_summary($month_id, 
                                        $calculation_type, $calculation_id, $month_begin_date, $month_end_date);        
    

}

function sc_calculate_monthly_company_receipts_summary($month_id,  
                                        $calculation_type, $calculation_id, $month_begin_date, $month_end_date){
    
    //customer payments
    // bank deposits
    
    $total = get_monthly_summary_company_customer_payment_receipts($month_begin_date, $month_end_date);    
    add_to_monthly_summary_company($month_id, SCVT_COMP_CUSTOMER_PAYMENT_RECEIPTS, $calculation_type, $total, $calculation_id);
    
    $total = get_monthly_summary_company_bank_deposits($month_begin_date, $month_end_date);    
    add_to_monthly_summary_company($month_id, SCVT_COMP_BANK_DEPOSITS, $calculation_type, $total, $calculation_id);
    
}


function sc_calculate_monthly_company_payments_summary($month_id,   
                                        $calculation_type, $calculation_id, $month_begin_date, $month_end_date){
    // supplier payments
    // bank payments

    $total = get_monthly_summary_company_supplier_payments($month_begin_date, $month_end_date);    
    add_to_monthly_summary_company($month_id, SCVT_COMP_SUPPLIER_PAYMENTS, $calculation_type, $total, $calculation_id);
    
    $total = get_monthly_summary_company_bank_payments($month_begin_date, $month_end_date);    
    add_to_monthly_summary_company($month_id, SCVT_COMP_BANK_PAYMENTS, $calculation_type, $total, $calculation_id);

}
