29 require_once NOALYSS_INCLUDE.
'/database/class_stock_sql.php';
42 require_once NOALYSS_INCLUDE.
'/lib/class_sort_table.php';
44 "wamount_start",
"wamount_end",
"wcode_stock",
"wdirection"));
47 $tb->add(
"Date",
$p_url,
" order by real_date asc",
"order by real_date desc",
"da",
"dd");
48 $tb->add(
"Code Stock",
$p_url,
" order by sg_code asc",
"order by sg_code desc",
"sa",
"sd");
49 $tb->add(
"Dépôt",
$p_url,
" order by r_name asc",
"order by r_name desc",
"ra",
"rd");
50 $tb->add(
"Fiche",
$p_url,
" order by 2 asc",
"order by 2 desc",
"fa",
"fd");
51 $tb->add(
"Commentaire",
$p_url,
" order by coalesce(sg_comment,jr_comment) asc",
"order by coalesce(sg_comment,jr_comment) desc",
"ca",
"cd");
52 $tb->add(
"Montant",
$p_url,
" order by j_montant asc",
"order by j_montant desc",
"ja",
"jd");
53 $tb->add(
"Quantité",
$p_url,
" order by sg_quantity asc",
"order by sg_quantity desc",
"qa",
"qd");
54 $tb->add(
"IN/OUT",
$p_url,
" order by (case when sg_type='c' then 'OUT' when sg_type='c' then 'IN' end ) asc",
"order by (case when sg_type='c' then 'OUT' when sg_type='c' then 'IN' end ) desc",
"ta",
"td");
58 $step = $_SESSION[
'g_pagesize'];
74 require_once NOALYSS_TEMPLATE.
'/stock_histo.php';
81 echo
'<form style="display:inline" method="GET" action="export.php">';
83 "wamount_start",
"wamount_end",
"wcode_stock",
"wdirection"));
90 echo
'<form style="display:inline" method="GET" action="export.php">';
99 $bt =
HtmlInput::button(
"Recherche",
"Recherche",
' onclick="$(\'histo_search_d\').show();"');
108 $wrepo->value[] = array(
'value' => -1,
'label' =>
'Tous les dépôts');
110 $wdate_start =
new IDate(
'wdate_start');
111 $wdate_end =
new IDate(
'wdate_end');
112 $wamount_start =
new INum(
'wamount_start');
113 $wamount_end =
new INum(
'wamount_end');
114 $wcard =
new ICard(
'wcard');
115 $wcode_stock =
new ICard(
'wcode_stock');
116 $wdirection =
new ISelect(
"wdirection");
133 $wcard->extra =
"all";
134 $wcard->set_attribute(
"typecard",
"all");
138 $wcode_stock->extra =
" [sql] fd_id=500000 ";
139 $wcode_stock->set_attribute(
"typecard",
"[sql] fd_id=500000");
146 $wdirection->value = array(
147 array(
'value' =>
"-1",
'label' =>
"Tout"),
148 array(
'value' =>
"c",
'label' =>
"OUT"),
149 array(
'value' =>
"d",
'label' =>
"IN")
153 require_once NOALYSS_TEMPLATE.
'/stock_histo_search.php';
163 (select ad_value from fiche_Detail as fd1 where ad_id=1 and fd1.f_id=jx.f_id) as fname,
164 (select ad_value from fiche_Detail as fd1 where ad_id=23 and fd1.f_id=jx.f_id) as qcode,
166 coalesce(sg_comment,jr_comment) as ccomment,
173 case when sg_type='c' then 'OUT' when sg_type='d' then 'IN' end as direction,
176 coalesce(sg_date,jr_date) as real_date,
177 to_char(coalesce(sg_date,jr_date),'DD.MM.YY') as cdate
178 from stock_goods as sg
179 join stock_repository as sr on (sg.r_id=sr.r_id)
180 left join jrnx as jx on (sg.j_id=jx.j_id)
181 left join jrn as j on (j.jr_grpt_id=jx.j_grpt)
183 sg.r_id in (select r_id from profile_sec_repository where p_id = $profile)";
188 $clause = $and.
" to_date('" .
sql_string(
$p_array[
'wdate_start']) .
"','DD.MM.YYYY')<=coalesce(sg_date,jr_date) ";
192 $clause.=$and .
" to_date('" .
sql_string(
$p_array[
'wdate_end']) .
"','DD.MM.YYYY')>=coalesce(sg_date,jr_date) ";
228 return $sql . $clause;
236 $a_repository = $g_user->get_available_repository(
'R');
237 $a_code = $cn->get_array(
"select distinct sg_code from tmp_stockgood_detail where s_id=$1", array(
$tmp_id));
248 require_once NOALYSS_TEMPLATE.
'/stock_summary_table.php';
252 require_once NOALYSS_TEMPLATE.
'/stock_summary_list.php';
262 if (isset (
$p_array[
'state_exercice']))
269 $periode_id=$g_user->get_periode();
273 $tmp_id = $cn->get_next_seq(
"public.tmp_stockgood_s_id_seq");
274 $cn->exec_sql(
"delete from tmp_stockgood where s_date < now() - interval '2 days' ");
275 $cn->exec_sql(
"insert into tmp_stockgood(s_id) values ($1)", array(
$tmp_id));
278 $a_repository = $g_user->get_available_repository(
'R');
282 insert into tmp_stockgood_detail(s_id,sg_code,s_qin,r_id,f_id)
283 select $tmp_id,trim(sg_code), coalesce(sum(sg_quantity),0) as qin,r_id,f_id
288 and j_id in (select j_id from jrnx where j_tech_per in (select p_id from parm_periode where p_exercice=$2))
289 and r_id in (select r_id from profile_sec_repository where p_id=$1)
290 group by r_id,trim(sg_code),f_id
294 $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(),
$periode->p_exercice));
296 insert into tmp_stockgood_detail(s_id,sg_code,s_qout,r_id,f_id)
297 select $tmp_id,trim(sg_code) , coalesce(sum(sg_quantity),0) as qout,r_id,f_id
298 from stock_goods as sg
301 and sg.j_id is not null
302 and sg.j_id in (select j_id from jrnx where j_tech_per in (select p_id from parm_periode where p_exercice=$2))
303 and sg.r_id in (select r_id from profile_sec_repository where p_id=$1)
304 group by r_id,trim(sg_code),f_id
306 $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(),
$periode->p_exercice));
310 insert into tmp_stockgood_detail(s_id,sg_code,s_qin,r_id,f_id)
311 select $tmp_id,trim(sg_code) , coalesce(sum(sg_quantity),0) as qin,r_id,f_id
312 from stock_goods as sg
316 and sg_date >= ( select min(p_start) from parm_periode where p_exercice=$2)
317 and sg_date <= ( select max(p_end) from parm_periode where p_exercice=$2)
318 and sg.r_id in (select r_id from profile_sec_repository where p_id=$1)
319 group by r_id,trim(sg_code),f_id
322 $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(),
$periode->p_exercice));
324 insert into tmp_stockgood_detail(s_id,sg_code,s_qout,r_id,f_id)
325 select $tmp_id,trim(sg_code), coalesce(sum(sg_quantity),0) as qout,r_id,f_id
330 and r_id in (select r_id from profile_sec_repository where p_id=$1)
331 and sg_date >= ( select min(p_start) from parm_periode where p_exercice=$2)
332 and sg_date <= ( select max(p_end) from parm_periode where p_exercice=$2)
333 group by r_id,trim(sg_code),f_id
335 $cn->exec_sql($sql_repo_detail, array($g_user->get_profile(),
$periode->p_exercice));
create_query_histo($p_array)
sql_string($p_string)
Fix the problem with the quote char for the database.
static num_row($ret)
wrapper for the function pg_NumRows
export_stock_summary_list_form()
format_date($p_date, $p_from_format= 'YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)
For the periode tables parm_periode and jrn_periode.
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
global $g_user
Find the default module or the first one.
function trim(s)
remove trailing and heading space
Description of class_syn_sort_table.
Input HTML for the card show buttons, in the file, you have to add card.js How to use : ...
build_tmp_table($p_array)
export_stock_histo_form()
history($p_array)
show history of all the stock movement
if($g_parameter->MY_STOCK== 'N') if(isset($_POST['add_stock'])) if(isset($_POST['mod_stock'])) $tb
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
This class handles only the numeric input, the input will call a javascript to change comma to period...