0000633: export en CSV des mouvement des stocks
0000634: export en CSV de la liste des stocks
This commit is contained in:
parent
7edcddf75f
commit
31d6dd2b4c
5 changed files with 93 additions and 45 deletions
|
|
@ -164,6 +164,12 @@ if ( $action=='X' || ! isset($_GET['act']) || $g_user->check_print($_GET['act'])
|
||||||
case 'CSV:ActionGestion':
|
case 'CSV:ActionGestion':
|
||||||
require_once 'export_follow_up_csv.php';
|
require_once 'export_follow_up_csv.php';
|
||||||
break;
|
break;
|
||||||
|
case 'CSV:StockHisto': // Export Historique mouvement stock
|
||||||
|
require_once 'export_stock_histo.csv';
|
||||||
|
break;
|
||||||
|
case 'CSV:StockResmList' : // 'Export Résumé list stock
|
||||||
|
require_once 'export_stock_resume_list.php';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
alert('Action inconnue '.$_GET['act']);
|
alert('Action inconnue '.$_GET['act']);
|
||||||
exit();
|
exit();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
body {
|
body {
|
||||||
font-size:7pt
|
font-size:7pt
|
||||||
}
|
}
|
||||||
select ,.input_text{
|
select ,.input_text{
|
||||||
border:1px solid #FFFFFF;
|
border:1px solid #FFFFFF;
|
||||||
}
|
}
|
||||||
form {
|
form {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
.print {
|
.print {
|
||||||
|
|
@ -13,7 +13,7 @@ form {
|
||||||
.noprint {
|
.noprint {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
@ -23,10 +23,10 @@ div.recherche_form {
|
||||||
table.result {
|
table.result {
|
||||||
font-size:7pt;
|
font-size:7pt;
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
|
width:100%
|
||||||
}
|
}
|
||||||
|
|
||||||
table.result th {
|
table.result th {
|
||||||
font-size:7pt;
|
font-size:7pt;
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +40,7 @@ div.info {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2.info {
|
h1,h2.info {
|
||||||
font-size:14pt;
|
font-size:14pt;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
|
|
@ -97,7 +97,7 @@ div.redcontent{
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
|
|
||||||
}
|
}
|
||||||
div.redcontent{
|
div.redcontent{
|
||||||
font-size:7pt;
|
font-size:7pt;
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ div.rmenu {
|
||||||
table.mtitle {
|
table.mtitle {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
td.mshort {
|
td.mshort {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
td.mlltitle {
|
td.mlltitle {
|
||||||
|
|
@ -130,10 +130,10 @@ span.mtitle2 {
|
||||||
span.mtitle {
|
span.mtitle {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
span.odd {
|
span.odd {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
span.even {
|
span.even {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +230,7 @@ font-size:8pt;
|
||||||
font-family:sans-serif;
|
font-family:sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.detail:hover
|
a.detail:hover
|
||||||
{
|
{
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -251,16 +251,37 @@ class Stock extends Stock_Sql
|
||||||
|
|
||||||
$max_row = Database::num_row($res);
|
$max_row = Database::num_row($res);
|
||||||
|
|
||||||
$nav_bar= jrn_navigation_bar($offset,$max_row,0,$page);
|
$nav_bar = jrn_navigation_bar($offset, $max_row, 0, $page);
|
||||||
|
|
||||||
if ( $step != -1 ) $res = $this->cn->exec_sql($sql." , sg_id asc limit ".$step." offset ".$offset);
|
if ($step != -1)
|
||||||
|
$res = $this->cn->exec_sql($sql . " , sg_id asc limit " . $step . " offset " . $offset);
|
||||||
$max_row = Database::num_row($res);
|
$max_row = Database::num_row($res);
|
||||||
|
|
||||||
$this->search_box_button();
|
$this->search_box_button();
|
||||||
$this->search_box($p_array);
|
$this->search_box($p_array);
|
||||||
require_once 'template/stock_histo.php';
|
require_once 'template/stock_histo.php';
|
||||||
|
$this->export_stock_histo_form();
|
||||||
|
echo HtmlInput::print_window();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function export_stock_histo_form()
|
||||||
|
{
|
||||||
|
echo '<form style="display:inline" method="GET" action="export.php">';
|
||||||
|
echo HtmlInput::get_to_hidden(array("gDossier", "wcard", "wdate_start", "wdate_end", "wrepo",
|
||||||
|
"wamount_start", "wamount_end", "wcode_stock", "wdirection"));
|
||||||
|
echo HtmlInput::hidden('act','CSV:StockHisto');
|
||||||
|
echo HtmlInput::submit('stockhisto','Export CSV');
|
||||||
|
echo '</form>';
|
||||||
|
}
|
||||||
|
function export_stock_summary_list_form()
|
||||||
|
{
|
||||||
|
echo '<form style="display:inline" method="GET" action="export.php">';
|
||||||
|
echo HtmlInput::get_to_hidden(array("gDossier", "state_exercice"));
|
||||||
|
echo HtmlInput::hidden('act','CSV:StockResmList');
|
||||||
|
|
||||||
|
echo HtmlInput::submit('stockresm','Export CSV');
|
||||||
|
echo '</form>';
|
||||||
|
}
|
||||||
function search_box_button()
|
function search_box_button()
|
||||||
{
|
{
|
||||||
$bt = HtmlInput::button("Recherche", "Recherche", ' onclick="$(\'histo_search_d\').show();"');
|
$bt = HtmlInput::button("Recherche", "Recherche", ' onclick="$(\'histo_search_d\').show();"');
|
||||||
|
|
@ -409,15 +430,42 @@ class Stock extends Stock_Sql
|
||||||
function summary($p_array)
|
function summary($p_array)
|
||||||
{
|
{
|
||||||
global $cn, $g_user;
|
global $cn, $g_user;
|
||||||
$tmp_id=$cn->get_next_seq("public.tmp_stockgood_s_id_seq");
|
$tmp_id=$this->build_tmp_table($p_array);
|
||||||
$cn->exec_sql("delete from tmp_stockgood where s_date < now() - interval '2 hours' ");
|
// Build condition
|
||||||
$cn->exec_sql("insert into tmp_stockgood(s_id) values ($1)",array($tmp_id));
|
$a_repository = $g_user->get_available_repository('R');
|
||||||
|
$a_code = $cn->get_array("select distinct sg_code from tmp_stockgood_detail where s_id=$1", array($tmp_id));
|
||||||
|
if (isset($p_array['present']))
|
||||||
|
{
|
||||||
|
$present = $p_array['present'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$present = 'T';
|
||||||
|
}
|
||||||
|
if ($present == 'T')
|
||||||
|
{
|
||||||
|
require_once 'template/stock_summary_table.php';
|
||||||
|
}
|
||||||
|
if ($present == 'L')
|
||||||
|
{
|
||||||
|
require_once 'template/stock_summary_list.php';
|
||||||
|
$this->export_stock_summary_list_form();
|
||||||
|
|
||||||
|
}
|
||||||
|
echo HtmlInput::print_window();
|
||||||
|
}
|
||||||
|
function build_tmp_table($p_array)
|
||||||
|
{
|
||||||
|
global $cn,$g_user;
|
||||||
|
$tmp_id = $cn->get_next_seq("public.tmp_stockgood_s_id_seq");
|
||||||
|
$cn->exec_sql("delete from tmp_stockgood where s_date < now() - interval '2 days' ");
|
||||||
|
$cn->exec_sql("insert into tmp_stockgood(s_id) values ($1)", array($tmp_id));
|
||||||
|
|
||||||
// get all readable repository
|
// get all readable repository
|
||||||
$a_repository=$g_user->get_available_repository('R');
|
$a_repository = $g_user->get_available_repository('R');
|
||||||
|
|
||||||
// All the stock card
|
// All the stock card
|
||||||
$sql_repo_detail="
|
$sql_repo_detail = "
|
||||||
insert into tmp_stockgood_detail(s_id,sg_code,s_qin,s_qout,r_id)
|
insert into tmp_stockgood_detail(s_id,sg_code,s_qin,s_qout,r_id)
|
||||||
|
|
||||||
with fiche_stock as (select distinct ad_value from fiche_detail where ad_id=19 and coalesce(ad_value,'') != '') ,
|
with fiche_stock as (select distinct ad_value from fiche_detail where ad_id=19 and coalesce(ad_value,'') != '') ,
|
||||||
|
|
@ -449,35 +497,19 @@ class Stock extends Stock_Sql
|
||||||
and sg.r_id in (select r_id from user_sec_repository where p_id=$1)
|
and sg.r_id in (select r_id from user_sec_repository where p_id=$1)
|
||||||
|
|
||||||
";
|
";
|
||||||
|
$end_date = $cn->get_value("select to_char(max(p_end),'DD.MM.YYYY') from parm_periode");
|
||||||
// Build condition
|
|
||||||
$end_date=$cn->get_value("select to_char(max(p_end),'DD.MM.YYYY') from parm_periode");
|
|
||||||
if (isset($p_array['state_exercice']))
|
if (isset($p_array['state_exercice']))
|
||||||
{
|
{
|
||||||
if ( isDate($p_array['state_exercice'])==$p_array['state_exercice'])
|
if (isDate($p_array['state_exercice']) == $p_array['state_exercice'])
|
||||||
{
|
{
|
||||||
$end_date=$p_array['state_exercice'];
|
$end_date = $p_array['state_exercice'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cn->exec_sql($sql_repo_detail,array($g_user->get_profile(),$end_date));
|
$cn->exec_sql($sql_repo_detail, array($g_user->get_profile(), $end_date));
|
||||||
$a_code=$cn->get_array("select distinct sg_code from tmp_stockgood_detail where s_id=$1",array($tmp_id));
|
|
||||||
if (isset($p_array['present']))
|
return $tmp_id;
|
||||||
{
|
|
||||||
$present=$p_array['present'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$present='T';
|
|
||||||
}
|
|
||||||
if ($present == 'T')
|
|
||||||
{
|
|
||||||
require_once 'template/stock_summary_table.php' ;
|
|
||||||
}
|
|
||||||
if ($present=='L')
|
|
||||||
{
|
|
||||||
require_once 'template/stock_summary_list.php';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,20 @@
|
||||||
* @brief show the result to stock state in list format (more detailled)
|
* @brief show the result to stock state in list format (more detailled)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$a_repo=$cn->get_array("select distinct t.r_id,r_name,r_adress,r_country from stock_repository as s join tmp_stockgood_detail as t
|
$a_repo=$cn->get_array("select distinct t.r_id,r_name,r_adress,r_city,r_country,r_phone from stock_repository as s join tmp_stockgood_detail as t
|
||||||
on (s.r_id=t.r_id)
|
on (s.r_id=t.r_id)
|
||||||
where
|
where
|
||||||
s_id=$1
|
s_id=$1
|
||||||
order by 2
|
order by 2
|
||||||
",array($tmp_id));
|
",array($tmp_id));
|
||||||
?>
|
?>
|
||||||
|
<div class="content">
|
||||||
<? for ($r=0;$r<count($a_repo);$r++):?>
|
<? for ($r=0;$r<count($a_repo);$r++):?>
|
||||||
<h1><?=$a_repo[$r]['r_name']?></h1>
|
<h1><?=$a_repo[$r]['r_name']?></h1>
|
||||||
<p><?=$a_repo[$r]['r_adress']?></p>
|
<p>Adresse <?=$a_repo[$r]['r_adress']?></p>
|
||||||
<p><?=$a_repo[$r]['r_country']?></p>
|
<p>Ville <?=$a_repo[$r]['r_city']?></p>
|
||||||
|
<p>Pays <?=$a_repo[$r]['r_country']?></p>
|
||||||
|
<p>Téléphone <?=$a_repo[$r]['r_phone']?></p>
|
||||||
<table class="result">
|
<table class="result">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Code</th>
|
<th>Code</th>
|
||||||
|
|
@ -97,3 +100,4 @@ $a_repo=$cn->get_array("select distinct t.r_id,r_name,r_adress,r_country from st
|
||||||
</table>
|
</table>
|
||||||
<? endfor; ?>
|
<? endfor; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -221,7 +221,7 @@ INSERT INTO menu_ref(me_code, me_menu, me_file, me_url, me_description, me_param
|
||||||
INSERT INTO profile_menu(me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
|
INSERT INTO profile_menu(me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
|
||||||
VALUES ('CFGSTOCK', 'PARAM', 1, 40, 'E', 0);
|
VALUES ('CFGSTOCK', 'PARAM', 1, 40, 'E', 0);
|
||||||
update menu_ref set me_file=null where me_code='STOCK';
|
update menu_ref set me_file=null where me_code='STOCK';
|
||||||
update profile_menu set me_code_dep='COMPTA' where me_code='STOCK' and me_code_dep='ADV';
|
update profile_menu set me_code_dep='COMPTA',p_order=15 where me_code='STOCK' and me_code_dep='ADV';
|
||||||
|
|
||||||
CREATE TABLE stock_repository
|
CREATE TABLE stock_repository
|
||||||
(
|
(
|
||||||
|
|
@ -278,11 +278,17 @@ update menu_ref set me_file=null where me_code='STOCK';
|
||||||
|
|
||||||
insert into menu_ref (me_code,me_file,me_menu,me_description,me_type) values ('STOCK_HISTO','stock_histo.inc.php','Historique stock','Historique des mouvement de stock','ME');
|
insert into menu_ref (me_code,me_file,me_menu,me_description,me_type) values ('STOCK_HISTO','stock_histo.inc.php','Historique stock','Historique des mouvement de stock','ME');
|
||||||
insert into menu_ref (me_code,me_file,me_menu,me_description,me_type) values ('STOCK_STATE','stock_state.inc.php','Etat des stock','Etat des stock','ME');
|
insert into menu_ref (me_code,me_file,me_menu,me_description,me_type) values ('STOCK_STATE','stock_state.inc.php','Etat des stock','Etat des stock','ME');
|
||||||
|
insert into menu_ref (me_code,me_menu,me_type) values ('CSV:StockHisto','Export Historique mouvement stock','PR');
|
||||||
|
insert into menu_ref (me_code,me_menu,me_type) values ('CSV:StockResmList','Export Résumé list stock','PR');
|
||||||
|
|
||||||
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_HISTO','STOCK',1,10,'E');
|
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_HISTO','STOCK',1,10,'E');
|
||||||
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_STATE','STOCK',1,20,'E');
|
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_STATE','STOCK',1,20,'E');
|
||||||
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_HISTO','STOCK',2,10,'E');
|
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_HISTO','STOCK',2,10,'E');
|
||||||
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_STATE','STOCK',2,20,'E');
|
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_STATE','STOCK',2,20,'E');
|
||||||
|
insert into profile_menu(me_code,p_id,p_type_display) values ('CSV:StockHisto',1,'P');
|
||||||
|
insert into profile_menu(me_code,p_id,p_type_display) values ('CSV:StockResmList',1,'P');
|
||||||
|
insert into profile_menu(me_code,p_id,p_type_display) values ('CSV:StockHisto',2,'P');
|
||||||
|
insert into profile_menu(me_code,p_id,p_type_display) values ('CSV:StockResmList',2,'P');
|
||||||
|
|
||||||
-- clean stock_goods
|
-- clean stock_goods
|
||||||
delete from stock_goods where sg_code is null or sg_code='' or sg_code not in (select ad_value from fiche_detail as fd where ad_id=19 and ad_value is not null);
|
delete from stock_goods where sg_code is null or sg_code='' or sg_code not in (select ad_value from fiche_detail as fd where ad_id=19 and ad_value is not null);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue