Add inventory changes ( tax, net purchase price

This commit is contained in:
2017-01-06 18:24:43 +01:00
parent 6de07dac93
commit f3d00953c8
16 changed files with 547 additions and 287 deletions

View File

@@ -81,7 +81,11 @@ class InventoryItemController extends Controller
['item_count_sold', 'Eladott mennyiség (db)'],
['item_count_in', 'Beszerzett mennyiség (db)'],
['item_count', 'Leltározott mennyiség (db)'],
['item_difference', 'Különbség (db)'],
['item_purchase_price_net', 'Nettó beszerezési ár (Ft)'],
['item_net_stock_money', 'Nettó készlet érték (Ft)'],
['item_stock_missing_count', 'Különbség (db)'],
['item_price_brutto', 'Bruttó eladási ár (Ft)'],
['item_stock_missing_money', 'Leltár hiány (Ft)'],
['item_count_system', 'Rendszer szerinti mennyiség (db)'],
];
$cols = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'];
@@ -121,11 +125,13 @@ class InventoryItemController extends Controller
// 'name' => 'Verdana'
foreach (range('A', 'I') as $columnID) {
foreach (range('A', 'N') as $columnID) {
$sheet->getColumnDimension($columnID)->setAutoSize(true);
$sheet->getStyle($columnID . '1')->applyFromArray($styleArray);
}
$sheet->freezePane( "N2" );
// Redirect output to a clients web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="leltar.xls"');
@@ -191,32 +197,18 @@ class InventoryItemController extends Controller
{
$model = $this->findModel($id);
$inventory = Inventory::findOne($model->id_inventory);
if (!$inventory->isOpen()) {
throw new NotAcceptableHttpException("A leltár elem nem található");
}
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$model->recalculateTotalPriceBrutto();
$model->save(false);
\Yii::$app->session->setFlash('success', "Mennyiség elmentve: " . $model->productName . ' - ' .$model->count . ' db');
// $prev = Url::previous("inventory-item-index");
$next = InventoryItem::findNextItemAlphabetical($model->id_inventory_item);
if ( isset($_POST['_next']) && isset($next)){
return $this->redirect(['inventory-item/update', 'id' => $next]);
}else{
return $this->redirect(['index', 'id' => $inventory->id_inventory]);
}
} else {
return $this->render('update', [
'model' => $model,
@@ -226,11 +218,11 @@ class InventoryItemController extends Controller
}
/**
* @param null $idInventory the id of the inventory
* @param integer $id the inventory item id
* @return string
* @throws Exception
* @throws NotAcceptableHttpException
* @throws NotFoundHttpException
*/
public function actionUpdateItem($idInventory = null,$id = null)
{
@@ -269,7 +261,6 @@ class InventoryItemController extends Controller
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$model->recalculateTotalPriceBrutto();
if ( $model->save(false) ){
\Yii::$app->session->setFlash('success', "Mennyiség elmentve: " . $model->productName . ' - ' .$model->count . ' db');