<?php

$search_data =& cw_session_register('search_data', array());
cw_load('accounting');
if ($action == 'search') {
    $search_data['movements'][$movement_type] = $posted_data;
    cw_header_location("index.php?target={$target}&mode=search");
}
if ($mode == 'search') {
    $search_data['movements'][$movement_type]['page'] = $page;
    if (AREA_TYPE == 'P') {
        $search_data['movements'][$movement_type]['warehouse_customer_id'] = $user_account['warehouse_customer_id'];
    }
    list($movements, $navigation) = cw_accounting_get_movements($movement_type, $search_data['movements'][$movement_type]);
    $navigation['script'] = "index.php?target={$target}&mode=search";
    $smarty->assign('navigation', $navigation);
    $smarty->assign('movements', $movements);
}
$smarty->assign('search_prefilled', $search_data['movements'][$movement_type]);
$smarty->assign('mode', $mode);
$smarty->assign('js_tab', $js_tab);
$smarty->assign('main', 'movements');
<?php

cw_load('accounting');
if ($action == 'cash') {
    $search_Data =& cw_session_register('search_data');
    $data = array('pos_customer_id' => $pos_customer_id, 'date_start' => $search_data['pos_report']['from_date'], 'date_end' => $search_data['pos_report']['to_date'], 'all' => 1);
    if ($group_by == 1) {
        $data['by_doc'] = 1;
    }
    list($movements) = cw_accounting_get_movements('G', $data);
    $smarty->assign('movements', $movements);
    $smarty->assign('group_by', $group_by);
    $smarty->assign('movements_type', 'G');
}
$smarty->assign('el_name', $el_name);
cw_display('main/accounting/movements_ajax.tpl', $smarty);
exit(0);