99 lines
5.8 KiB
PHP
99 lines
5.8 KiB
PHP
<?php
|
|
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
|
die ( 'Not A Valid Entry Point' );
|
|
|
|
// require_once('modules/EcmGroupSales/HeaderMenu.php');
|
|
|
|
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
|
|
|
|
require_once ('modules/EcmStockDocOuts/EcmStockDocOut.php');
|
|
require_once ('include/time.php');
|
|
require_once ('include/json_config.php');
|
|
|
|
// add jquery
|
|
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>';
|
|
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
|
|
echo '<script type="text/javascript"
|
|
src="include/jQuery/jquery-2.1.0.min.js"></script>';
|
|
echo '<script type="text/javascript"
|
|
src="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.js"></script>';
|
|
echo '<script type="text/javascript"
|
|
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
|
|
|
|
$json_config = new json_config ();
|
|
|
|
$focus = new EcmStockDocOut ();
|
|
|
|
if (isset ( $_REQUEST ['record'] )) {
|
|
$focus->retrieve ( $_REQUEST ['record'] );
|
|
$focus->format_all_fields ();
|
|
$OPT ['status'] = $focus->status;
|
|
|
|
}
|
|
|
|
require_once ('include/MVC/View/SugarView.php');
|
|
require_once ('modules/EcmStockDocOuts/views/DetailView/view.detail.my.php');
|
|
$edit = new ViewDetailMy ();
|
|
$edit->ss = new Sugar_Smarty ();
|
|
$edit->module = 'EcmStockDocOuts';
|
|
$db = $GLOBALS['db'];
|
|
|
|
$res = $db->query ( "SELECT footer, content FROM ecmstockdocout_pdf WHERE id='".$_REQUEST ['record']."'" );
|
|
|
|
if ($res->num_rows == 0) {
|
|
// create and save doc
|
|
$btn ='<input title="Generuj PDF" class="button" onclick="if($(\'#div_pdf\').css(\'display\') == \'none\'){$(\'#div_pdf\').show(\'slow\'); } else { $(\'#div_pdf\').hide(\'slow\'); }" type="button" name="productcard" id="productcard" value="Generuj PDF">';
|
|
$btn .= '<div id="div_pdf" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
|
$btn .= 'Typ: <select name="pdf_images" id="pdf_type"><option value="1">Dokument WZ</option></select><br /><br />';
|
|
$btn .= 'EAN: <select name="pdf_ean" id="pdf_ean"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
|
$btn .= 'EAN2: <select name="pdf_ean2" id="pdf_ean2"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
|
$btn .= 'Kod odbiorcy: <select name="pdf_recipient_code" id="pdf_recipient_code"><option value="1" selected>Tak</option><option value="0">Nie</option></select><br /><br />';
|
|
$btn .= 'Informacje logistyczne: <select name="pdf_logistic_info" id="pdf_logistic_info"><option value="1">Tak</option><option selected value="0">Nie</option></select><br /><br />';
|
|
$btn .= 'Numery partii: <select name="pdf_part_no" id="pdf_part_no"><option value="1">Tak</option><option selected value="0">Nie</option></select><br /><br />';
|
|
$btn .= '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmStockDocOuts&action=createPDF&to_pdf=1&show_img=no&pdf_type=\'+$(\'#pdf_type\').val()+\'&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&show_logistic_info=\'+$(\'#pdf_logistic_info\').val()+\'&show_part_no=\'+$(\'#pdf_part_no\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż PDF"></div>';
|
|
|
|
} else {
|
|
$btn = '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmStockDocOuts&action=createPDF&to_pdf=1&show_img=no&pdf_type=\'+$(\'#pdf_type\').val()+\'&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Generuj PDF"></div>';
|
|
}
|
|
$edit->ss->assign("CREATE_PDF",$btn);
|
|
|
|
$can_edit = false;
|
|
global $current_user;
|
|
|
|
//get operations
|
|
|
|
$out = $db->fetchByAssoc($db->query("SELECT sum(price*quantity) as sum FROM ecmstockoperations WHERE type='1' AND parent_id='".$focus->id."'"));
|
|
$edit->ss->assign("OP_OUT", format_number($out['sum']));
|
|
$in = $db->fetchByAssoc($db->query("SELECT sum(price*quantity) as sum FROM ecmstockoperations WHERE type='0' AND parent_id='".$focus->id."'"));
|
|
$edit->ss->assign("OP_IN", format_number($in['sum']));
|
|
|
|
|
|
$a = new EcmSale();
|
|
$a->retrieve($focus->ecmsale_id);
|
|
|
|
$the_array ['ZS'] = "<a target='_blank' href='index.php?module=EcmSales&action=DetailView&record=$a->id'>".$a->document_no."</a>";
|
|
$edit->ss->assign ( "zs_no", $the_array ['ZS'] );
|
|
$fv_query= "select id,document_no from ecminvoiceouts where wz_id= '".$focus->id."' or wz_record_zb like '%".$focus->id."%' and deleted=0";
|
|
$rap= $focus->db->query($fv_query);
|
|
|
|
$dane=$focus->db->fetchByAssoc($rap);
|
|
|
|
$the_array['ECMINVOICEOUT_NAME']='<input type="hidden" id="mass_inv_'.$this->id.'" value="'.$dane['id'].'">
|
|
<input type="hidden" id="mass_'.$this->id.'" value="'.$this->parent_id.'"><a target="_blank" href="index.php?module=EcmInvoiceOuts&action=DetailView&record='.$dane['id'].'">'.$dane['document_no'].'</a>';
|
|
//create image options
|
|
$edit->ss->assign ( "fv_no",$the_array['ECMINVOICEOUT_NAME'] );
|
|
$edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name );
|
|
$edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name );
|
|
|
|
$edit->bean = $focus;
|
|
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
|
|
|
$edit->preDisplay ();
|
|
echo $edit->display ();
|
|
|
|
require_once ('include/SubPanel/SubPanelTiles.php');
|
|
$subpanel = new SubPanelTiles ( $focus, 'EcmStockDocOuts' );
|
|
echo $subpanel->display ();
|
|
// loading view
|
|
echo '<link rel="stylesheet" type="text/css" href="modules/EcmStockDocOuts/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
|
|
?>
|