KS - liquidation
This commit is contained in:
@@ -49,6 +49,12 @@ $edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name );
|
|||||||
$edit->bean = $focus;
|
$edit->bean = $focus;
|
||||||
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
||||||
|
|
||||||
|
if ($focus->type == '8a6b804b-fac7-5cc2-de19-54c209116b19') {
|
||||||
|
$r = $db->fetchByAssoc($db->query("SELECT COUNT(id) FROM ecommerce_invoices WHERE ecmstockdoccorrect_id = '".$focus->id."'"));
|
||||||
|
if ($r['COUNT(id)'] > 0) {
|
||||||
|
$edit->ss->assign ( "IS_RETURN", true );
|
||||||
|
}
|
||||||
|
}
|
||||||
$edit->preDisplay ();
|
$edit->preDisplay ();
|
||||||
echo $edit->display ();
|
echo $edit->display ();
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ if (isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] == "false") {
|
|||||||
$new_number = true;
|
$new_number = true;
|
||||||
$focus->stock_id = 'cf16804e-f698-5e09-2da3-6553588446ae';
|
$focus->stock_id = 'cf16804e-f698-5e09-2da3-6553588446ae';
|
||||||
$focus->register_date = date("d.m.Y");
|
$focus->register_date = date("d.m.Y");
|
||||||
|
$focus->type = '8a6b804b-fac7-5cc2-de19-54c209116b19';
|
||||||
|
$focus->name = 'Zwrot allegro';
|
||||||
$db = $GLOBALS['db'];
|
$db = $GLOBALS['db'];
|
||||||
$invoiceIds = $_SESSION[$_REQUEST['ecommerceKS']];
|
$invoiceIds = $_SESSION[$_REQUEST['ecommerceKS']];
|
||||||
|
|
||||||
@@ -124,9 +126,6 @@ if (isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] == "false") {
|
|||||||
$edit->ss->assign('ECOMMERCE_PRODUCTS', json_encode($finalProducts));
|
$edit->ss->assign('ECOMMERCE_PRODUCTS', json_encode($finalProducts));
|
||||||
$edit->ss->assign('ECOMMERCE_INVOICES', json_encode($invoiceIds));
|
$edit->ss->assign('ECOMMERCE_INVOICES', json_encode($invoiceIds));
|
||||||
$focus->ecommerce_invoices = $invoiceIds;
|
$focus->ecommerce_invoices = $invoiceIds;
|
||||||
$focus->type = '8a6b804b-fac7-5cc2-de19-54c209116b19';
|
|
||||||
$focus->stock_id = 'cf16804e-f698-5e09-2da3-6553588446ae';
|
|
||||||
$focus->name = 'Zwrot allegro';
|
|
||||||
|
|
||||||
$query = "SELECT document_no FROM ecommerce_invoices WHERE id IN ('" . implode('\',\'', $invoiceIds) . "')";
|
$query = "SELECT document_no FROM ecommerce_invoices WHERE id IN ('" . implode('\',\'', $invoiceIds) . "')";
|
||||||
$res = $db->query($query);
|
$res = $db->query($query);
|
||||||
@@ -135,6 +134,22 @@ if (isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] == "false") {
|
|||||||
$documentNos[] = $row['document_no'];
|
$documentNos[] = $row['document_no'];
|
||||||
}
|
}
|
||||||
$focus->pdf_text = "Dotyczy faktur: " . implode(', ', $documentNos);
|
$focus->pdf_text = "Dotyczy faktur: " . implode(', ', $documentNos);
|
||||||
|
} else if (isset($_REQUEST['liquidation'])) {
|
||||||
|
$new_number = true;
|
||||||
|
$focus->stock_id = 'cf16804e-f698-5e09-2da3-6553588446ae';
|
||||||
|
$focus->register_date = date("d.m.Y");
|
||||||
|
$focus->type = '7bb903d0-c296-7d1b-6e50-54c209e30850';
|
||||||
|
$focus->name = 'Likwidacja allegro';
|
||||||
|
$db = $GLOBALS['db'];
|
||||||
|
|
||||||
|
$ks = new EcmStockDocCorrect();
|
||||||
|
$ks->retrieve($_REQUEST['liquidation']);
|
||||||
|
$products = $ks->getPositionList(true);
|
||||||
|
foreach ($products as &$item) {
|
||||||
|
$item['quantity'] = -$item['quantity'];
|
||||||
|
}
|
||||||
|
unset($item);
|
||||||
|
$edit->ss->assign('ECOMMERCE_PRODUCTS', json_encode($products));
|
||||||
} else {
|
} else {
|
||||||
$new_number = true;
|
$new_number = true;
|
||||||
//dates
|
//dates
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ $viewdefs ['EcmStockDocCorrects'] ['DetailView'] = array (
|
|||||||
array(
|
array(
|
||||||
'customCode' => "{include_php file='include/ECM/EcmCreatePdfButton.php'}",
|
'customCode' => "{include_php file='include/ECM/EcmCreatePdfButton.php'}",
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'customCode' => '{if $IS_RETURN}<input type="button" class="button" name="liquidation" id="liquidation" value="Likwidacja" onclick="window.open(\'index.php?module=EcmStockDocCorrects&action=EditView&liquidation={$fields.id.value}\');">{/if}',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'hidden' => array(
|
'hidden' => array(
|
||||||
'<input type="hidden" name="vats_summary" id="vats_summary" value=\'{$fields.vats_summary.value}\'>',
|
'<input type="hidden" name="vats_summary" id="vats_summary" value=\'{$fields.vats_summary.value}\'>',
|
||||||
@@ -187,6 +190,3 @@ $viewdefs ['EcmStockDocCorrects'] ['DetailView'] = array (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user