Version Notes
This is a latest release of the extension.
Download this release
Release Info
Developer | Medma Infomatix |
Extension | Medma_Stock_Control |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 2.0.0
- app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit.php +43 -6
- app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit.php~ +84 -19
- app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit/Form.php +17 -14
- app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit/Form.php~ +19 -16
- app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Grid.php +7 -1
- app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Grid.php~ +16 -13
- app/code/local/Medma/Stockcontrol/controllers/Adminhtml/StockcontrolController.php +22 -1
- app/code/local/Medma/Stockcontrol/controllers/Adminhtml/StockcontrolController.php~ +156 -0
- app/code/local/Medma/Stockcontrol/sql/stockcontrol_setup/mysql4-install-0.1.0.php +1 -0
- app/code/local/Medma/Stockcontrol/sql/stockcontrol_setup/mysql4-install-0.1.0.php~ +11 -8
- package.xml +9 -7
app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit.php
CHANGED
@@ -3,20 +3,57 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit extends Mage_Adminhtm
|
|
3 |
{
|
4 |
public function __construct()
|
5 |
{
|
6 |
-
|
7 |
$this->_objectId = 'id';
|
8 |
$this->_blockGroup = 'stockcontrol';
|
9 |
$this->_controller = 'adminhtml_stockcontrol';
|
10 |
-
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
|
|
|
15 |
|
16 |
-
|
17 |
|
18 |
|
19 |
-
//
|
20 |
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getPresentQty/product_id/'+product_id+'/key/'+secret_key,
|
21 |
|
22 |
|
@@ -62,7 +99,7 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit extends Mage_Adminhtm
|
|
62 |
}
|
63 |
|
64 |
|
65 |
-
|
66 |
|
67 |
{
|
68 |
|
3 |
{
|
4 |
public function __construct()
|
5 |
{
|
6 |
+
parent::__construct();
|
7 |
$this->_objectId = 'id';
|
8 |
$this->_blockGroup = 'stockcontrol';
|
9 |
$this->_controller = 'adminhtml_stockcontrol';
|
10 |
+
$this->_formScripts[] = "
|
11 |
|
12 |
+
function getSku(base_url,product_id,next_quantity_id,secret_key){
|
13 |
+
|
14 |
+
|
15 |
+
//alert(base_url+product_id+next_quantity_id+secret_key);
|
16 |
+
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getSkuu/product_id/'+product_id+'/key/',
|
17 |
+
|
18 |
+
|
19 |
+
{
|
20 |
+
|
21 |
+
|
22 |
+
method:'Post',
|
23 |
+
|
24 |
+
|
25 |
+
onSuccess: function(transport){
|
26 |
+
|
27 |
+
|
28 |
+
var response = transport.responseText || 'no response text';
|
29 |
+
//alert('success'+response);
|
30 |
+
|
31 |
+
document.getElementById(next_quantity_id).value=response;
|
32 |
+
|
33 |
+
},
|
34 |
+
|
35 |
+
|
36 |
+
onFailure: function(){
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
alert('Failure in Ajax');
|
43 |
+
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
});
|
49 |
|
|
|
50 |
|
51 |
+
}
|
52 |
|
53 |
+
function getPresentQty(base_url,product_id,next_quantity_id,secret_key){
|
54 |
|
55 |
|
56 |
+
//alert(base_url+product_id+next_quantity_id+secret_key);
|
57 |
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getPresentQty/product_id/'+product_id+'/key/'+secret_key,
|
58 |
|
59 |
|
99 |
}
|
100 |
|
101 |
|
102 |
+
public function getHeaderText()
|
103 |
|
104 |
{
|
105 |
|
app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit.php~
CHANGED
@@ -1,32 +1,97 @@
|
|
1 |
<?php
|
2 |
-
class
|
3 |
{
|
4 |
public function __construct()
|
5 |
{
|
6 |
-
|
7 |
$this->_objectId = 'id';
|
8 |
$this->_blockGroup = 'stockcontrol';
|
9 |
$this->_controller = 'adminhtml_stockcontrol';
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
var response = transport.responseText || 'no response text';
|
19 |
-
alert('success'+response);
|
20 |
|
21 |
document.getElementById(next_quantity_id).value=response;
|
22 |
|
23 |
-
},
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
|
32 |
";
|
@@ -34,7 +99,7 @@ class Futurtek_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit extends Mage_Admin
|
|
34 |
}
|
35 |
|
36 |
|
37 |
-
|
38 |
|
39 |
{
|
40 |
|
1 |
<?php
|
2 |
+
class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
{
|
4 |
public function __construct()
|
5 |
{
|
6 |
+
parent::__construct();
|
7 |
$this->_objectId = 'id';
|
8 |
$this->_blockGroup = 'stockcontrol';
|
9 |
$this->_controller = 'adminhtml_stockcontrol';
|
10 |
+
$this->_formScripts[] = "
|
11 |
+
|
12 |
+
function getSku(base_url,product_id,next_quantity_id,secret_key){
|
13 |
+
|
14 |
+
|
15 |
+
//alert(base_url+product_id+next_quantity_id+secret_key);
|
16 |
+
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getSku/product_id/'+product_id+'/key/',
|
17 |
+
|
18 |
+
|
19 |
+
{
|
20 |
+
|
21 |
+
|
22 |
+
method:'Post',
|
23 |
+
|
24 |
+
|
25 |
+
onSuccess: function(transport){
|
26 |
+
|
27 |
+
|
28 |
+
var response = transport.responseText || 'no response text';
|
29 |
+
//alert('success'+response);
|
30 |
+
|
31 |
+
document.getElementById(next_quantity_id).value=response;
|
32 |
+
|
33 |
+
},
|
34 |
+
|
35 |
+
|
36 |
+
onFailure: function(){
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
alert('Failure in Ajax');
|
43 |
+
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
});
|
49 |
+
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
function getPresentQty(base_url,product_id,next_quantity_id,secret_key){
|
54 |
+
|
55 |
+
|
56 |
+
//alert(base_url+product_id+next_quantity_id+secret_key);
|
57 |
+
new Ajax.Request(base_url+'stockcontrol/adminhtml_stockcontrol/getPresentQty/product_id/'+product_id+'/key/'+secret_key,
|
58 |
+
|
59 |
+
|
60 |
+
{
|
61 |
+
|
62 |
+
|
63 |
+
method:'Post',
|
64 |
+
|
65 |
+
|
66 |
+
onSuccess: function(transport){
|
67 |
+
|
68 |
+
|
69 |
var response = transport.responseText || 'no response text';
|
70 |
+
//alert('success'+response);
|
71 |
|
72 |
document.getElementById(next_quantity_id).value=response;
|
73 |
|
74 |
+
},
|
75 |
+
|
76 |
+
|
77 |
+
onFailure: function(){
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
alert('Failure in Ajax');
|
84 |
+
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
});
|
90 |
+
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
|
96 |
|
97 |
";
|
99 |
}
|
100 |
|
101 |
|
102 |
+
public function getHeaderText()
|
103 |
|
104 |
{
|
105 |
|
app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit/Form.php
CHANGED
@@ -40,16 +40,15 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_Adm
|
|
40 |
/******************************************************************/
|
41 |
|
42 |
|
43 |
-
$
|
44 |
-
|
45 |
-
//print_r($products_model);exit;
|
46 |
$products_values= array();
|
47 |
|
48 |
$products_values[] = array(
|
49 |
|
50 |
-
|
51 |
|
52 |
-
|
53 |
);
|
54 |
$operation_values= array();
|
55 |
$operation_model=array('Stock In'=>'Stock In','Stock Out'=>'Stock Out');
|
@@ -67,19 +66,17 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_Adm
|
|
67 |
);
|
68 |
}
|
69 |
|
70 |
-
foreach($
|
71 |
-
|
|
|
72 |
$products_values[] = array(
|
73 |
-
'label' => $
|
74 |
'value' => $values['entity_id']
|
75 |
);
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
-
// Most Important Line for printing the above query //
|
80 |
|
81 |
-
//$collection->printlogquery(true);
|
82 |
-
//exit(0);
|
83 |
|
84 |
$fldInfo = $form->addFieldset('stockcontrol_info', array('legend'=> $hlp->__('Stockcontrol')));
|
85 |
|
@@ -93,8 +90,14 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_Adm
|
|
93 |
|
94 |
'values' =>$products_values,
|
95 |
|
96 |
-
'onchange' => "getPresentQty('$getbase_url',this.value,'present_qty','$getPresentQty_key');"
|
97 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
|
100 |
$fldInfo->addField('present_qty', 'text', array(
|
40 |
/******************************************************************/
|
41 |
|
42 |
|
43 |
+
$products_model_coll=Mage::getModel('catalog/product')->getCollection();
|
44 |
+
|
|
|
45 |
$products_values= array();
|
46 |
|
47 |
$products_values[] = array(
|
48 |
|
49 |
+
'label' => 'Select Product',
|
50 |
|
51 |
+
'value' => ''
|
52 |
);
|
53 |
$operation_values= array();
|
54 |
$operation_model=array('Stock In'=>'Stock In','Stock Out'=>'Stock Out');
|
66 |
);
|
67 |
}
|
68 |
|
69 |
+
foreach($products_model_coll->getData() as $key => $values):
|
70 |
+
$products_model = Mage::getModel('catalog/product')->load($values['entity_id']);
|
71 |
+
|
72 |
$products_values[] = array(
|
73 |
+
'label' => $products_model->getName(),
|
74 |
'value' => $values['entity_id']
|
75 |
);
|
76 |
+
|
77 |
+
endforeach;
|
78 |
|
|
|
|
|
79 |
|
|
|
|
|
80 |
|
81 |
$fldInfo = $form->addFieldset('stockcontrol_info', array('legend'=> $hlp->__('Stockcontrol')));
|
82 |
|
90 |
|
91 |
'values' =>$products_values,
|
92 |
|
93 |
+
'onchange' => "getSku('$getbase_url',this.value,'sku',''), getPresentQty('$getbase_url',this.value,'present_qty','$getPresentQty_key');"
|
94 |
));
|
95 |
+
$fldInfo->addField('sku', 'text', array(
|
96 |
+
'label' => $hlp->__('Sku'),
|
97 |
+
'name' => 'sku',
|
98 |
+
'readonly' =>'true',
|
99 |
+
|
100 |
+
));
|
101 |
|
102 |
|
103 |
$fldInfo->addField('present_qty', 'text', array(
|
app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Edit/Form.php~
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
protected function _prepareForm()
|
6 |
{
|
@@ -40,16 +40,15 @@ class Futurtek_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_
|
|
40 |
/******************************************************************/
|
41 |
|
42 |
|
43 |
-
$
|
44 |
-
|
45 |
-
//print_r($products_model);exit;
|
46 |
$products_values= array();
|
47 |
|
48 |
$products_values[] = array(
|
49 |
|
50 |
-
|
51 |
|
52 |
-
|
53 |
);
|
54 |
$operation_values= array();
|
55 |
$operation_model=array('Stock In'=>'Stock In','Stock Out'=>'Stock Out');
|
@@ -67,19 +66,17 @@ class Futurtek_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_
|
|
67 |
);
|
68 |
}
|
69 |
|
70 |
-
foreach($
|
71 |
-
|
|
|
72 |
$products_values[] = array(
|
73 |
-
'label' => $
|
74 |
'value' => $values['entity_id']
|
75 |
);
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
-
// Most Important Line for printing the above query //
|
80 |
|
81 |
-
//$collection->printlogquery(true);
|
82 |
-
//exit(0);
|
83 |
|
84 |
$fldInfo = $form->addFieldset('stockcontrol_info', array('legend'=> $hlp->__('Stockcontrol')));
|
85 |
|
@@ -93,8 +90,14 @@ class Futurtek_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_
|
|
93 |
|
94 |
'values' =>$products_values,
|
95 |
|
96 |
-
'onchange' => "getPresentQty('$getbase_url',this.value,'present_qty','$getPresentQty_key');"
|
97 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
|
100 |
$fldInfo->addField('present_qty', 'text', array(
|
@@ -111,7 +114,7 @@ class Futurtek_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_
|
|
111 |
|
112 |
));
|
113 |
$fldInfo->addField('added_qty', 'text', array(
|
114 |
-
'label' => $hlp->__('Qty(Stock In/Out)'),
|
115 |
'class' => 'required-entry',
|
116 |
'name' => 'added_qty',
|
117 |
|
1 |
<?php
|
2 |
|
3 |
+
class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
{
|
5 |
protected function _prepareForm()
|
6 |
{
|
40 |
/******************************************************************/
|
41 |
|
42 |
|
43 |
+
$products_model_coll=Mage::getModel('catalog/product')->getCollection();
|
44 |
+
|
|
|
45 |
$products_values= array();
|
46 |
|
47 |
$products_values[] = array(
|
48 |
|
49 |
+
'label' => 'Select Product',
|
50 |
|
51 |
+
'value' => ''
|
52 |
);
|
53 |
$operation_values= array();
|
54 |
$operation_model=array('Stock In'=>'Stock In','Stock Out'=>'Stock Out');
|
66 |
);
|
67 |
}
|
68 |
|
69 |
+
foreach($products_model_coll->getData() as $key => $values):
|
70 |
+
$products_model = Mage::getModel('catalog/product')->load($values['entity_id']);
|
71 |
+
|
72 |
$products_values[] = array(
|
73 |
+
'label' => $products_model->getName(),
|
74 |
'value' => $values['entity_id']
|
75 |
);
|
76 |
+
|
77 |
+
endforeach;
|
78 |
|
|
|
|
|
79 |
|
|
|
|
|
80 |
|
81 |
$fldInfo = $form->addFieldset('stockcontrol_info', array('legend'=> $hlp->__('Stockcontrol')));
|
82 |
|
90 |
|
91 |
'values' =>$products_values,
|
92 |
|
93 |
+
'onchange' => "getSku('$getbase_url',this.value,'sku',''), getPresentQty('$getbase_url',this.value,'present_qty','$getPresentQty_key');"
|
94 |
));
|
95 |
+
$fldInfo->addField('sku', 'text', array(
|
96 |
+
'label' => $hlp->__('sku'),
|
97 |
+
'name' => 'sku',
|
98 |
+
'readonly' =>'true',
|
99 |
+
|
100 |
+
));
|
101 |
|
102 |
|
103 |
$fldInfo->addField('present_qty', 'text', array(
|
114 |
|
115 |
));
|
116 |
$fldInfo->addField('added_qty', 'text', array(
|
117 |
+
'label' => $hlp->__('Qty(Qty(Stock In/Stock Out)'),
|
118 |
'class' => 'required-entry',
|
119 |
'name' => 'added_qty',
|
120 |
|
app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Grid.php
CHANGED
@@ -15,7 +15,7 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Grid extends Mage_Adminhtm
|
|
15 |
|
16 |
protected function _prepareCollection()
|
17 |
{
|
18 |
-
|
19 |
$catalogTable = Mage::getSingleton('core/resource')->getTableName('catalog_product_flat_1');
|
20 |
|
21 |
$collection->getSelect()->join(
|
@@ -79,6 +79,12 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Grid extends Mage_Adminhtm
|
|
79 |
'type' => 'text',
|
80 |
'width' => '100px',
|
81 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
return $this;
|
84 |
}
|
15 |
|
16 |
protected function _prepareCollection()
|
17 |
{
|
18 |
+
$collection = Mage::getModel('stockcontrol/stockcontrol')->getCollection();
|
19 |
$catalogTable = Mage::getSingleton('core/resource')->getTableName('catalog_product_flat_1');
|
20 |
|
21 |
$collection->getSelect()->join(
|
79 |
'type' => 'text',
|
80 |
'width' => '100px',
|
81 |
));
|
82 |
+
$this->addColumn('added_by', array(
|
83 |
+
'header' => Mage::helper('stockcontrol')->__('Added By'),
|
84 |
+
'index' => 'added_by',
|
85 |
+
'type' => 'text',
|
86 |
+
'width' => '100px',
|
87 |
+
));
|
88 |
|
89 |
return $this;
|
90 |
}
|
app/code/local/Medma/Stockcontrol/Block/Adminhtml/Stockcontrol/Grid.php~
CHANGED
@@ -15,20 +15,17 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Grid extends Mage_Adminhtm
|
|
15 |
|
16 |
protected function _prepareCollection()
|
17 |
{
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
$collection->getSelect()->join(
|
26 |
-
array('cisi'
|
27 |
'main_table.product_id = cisi.entity_id',
|
28 |
array('sku'=>'cisi.sku'));
|
29 |
-
//$collection->printLogQuery(true);
|
30 |
-
//print_r($collection);
|
31 |
-
//exit;
|
32 |
$this->setCollection($collection);
|
33 |
return parent::_prepareCollection();
|
34 |
}
|
@@ -40,8 +37,8 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Grid extends Mage_Adminhtm
|
|
40 |
'header'=> Mage::helper('stockcontrol')->__('Product Name'),
|
41 |
'width' => '80px',
|
42 |
'type' => 'text',
|
43 |
-
'index' => '
|
44 |
-
|
45 |
));
|
46 |
$this->addColumn('sku', array(
|
47 |
'header'=> Mage::helper('stockcontrol')->__('Sku'),
|
@@ -82,6 +79,12 @@ class Medma_Stockcontrol_Block_Adminhtml_Stockcontrol_Grid extends Mage_Adminhtm
|
|
82 |
'type' => 'text',
|
83 |
'width' => '100px',
|
84 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
return $this;
|
87 |
}
|
15 |
|
16 |
protected function _prepareCollection()
|
17 |
{
|
18 |
+
$collection = Mage::getModel('stockcontrol/stockcontrol')->getCollection();
|
19 |
+
$catalogTable = Mage::getSingleton('core/resource')->getTableName('catalog_product_flat_1');
|
20 |
+
|
21 |
+
$collection->getSelect()->join(
|
22 |
+
array('pc'=>$catalogTable),
|
23 |
+
'main_table.product_id = pc.entity_id',
|
24 |
+
array('product_name'=>'pc.name'));
|
25 |
$collection->getSelect()->join(
|
26 |
+
array('cisi'=>$catalogTable),
|
27 |
'main_table.product_id = cisi.entity_id',
|
28 |
array('sku'=>'cisi.sku'));
|
|
|
|
|
|
|
29 |
$this->setCollection($collection);
|
30 |
return parent::_prepareCollection();
|
31 |
}
|
37 |
'header'=> Mage::helper('stockcontrol')->__('Product Name'),
|
38 |
'width' => '80px',
|
39 |
'type' => 'text',
|
40 |
+
'index' => 'product_name',
|
41 |
+
'filter_index' => 'main_table.product_name'
|
42 |
));
|
43 |
$this->addColumn('sku', array(
|
44 |
'header'=> Mage::helper('stockcontrol')->__('Sku'),
|
79 |
'type' => 'text',
|
80 |
'width' => '100px',
|
81 |
));
|
82 |
+
$this->addColumn('operation', array(
|
83 |
+
'header' => Mage::helper('stockcontrol')->__('Operation'),
|
84 |
+
'index' => 'operation',
|
85 |
+
'type' => 'text',
|
86 |
+
'width' => '100px',
|
87 |
+
));
|
88 |
|
89 |
return $this;
|
90 |
}
|
app/code/local/Medma/Stockcontrol/controllers/Adminhtml/StockcontrolController.php
CHANGED
@@ -48,6 +48,11 @@ class Medma_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml
|
|
48 |
|
49 |
public function saveAction() {
|
50 |
$id= $this->getRequest()->getParam('id');
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
$model= Mage::getModel('stockcontrol/stockcontrol');
|
53 |
|
@@ -82,7 +87,7 @@ class Medma_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml
|
|
82 |
// ->loadByProduct($_product)->getQty();
|
83 |
// echo $stocklevel;exit;
|
84 |
try {
|
85 |
-
|
86 |
$model->setData($data)->setId($id);
|
87 |
$model->save();
|
88 |
|
@@ -119,6 +124,7 @@ class Medma_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml
|
|
119 |
}
|
120 |
$this->_redirect('*/*/');
|
121 |
}
|
|
|
122 |
public function getPresentQtyAction(){
|
123 |
$product_id = $this->getRequest()->getParam('product_id');
|
124 |
|
@@ -129,6 +135,21 @@ class Medma_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml
|
|
129 |
|
130 |
|
131 |
echo $stocklevel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
|
48 |
|
49 |
public function saveAction() {
|
50 |
$id= $this->getRequest()->getParam('id');
|
51 |
+
$user = Mage::getSingleton('admin/session');
|
52 |
+
$userId = $user->getUser()->getUserId();
|
53 |
+
$model_user= Mage::getModel('admin/user')->load($userId);
|
54 |
+
$addedby = $model_user['username'];
|
55 |
+
|
56 |
|
57 |
$model= Mage::getModel('stockcontrol/stockcontrol');
|
58 |
|
87 |
// ->loadByProduct($_product)->getQty();
|
88 |
// echo $stocklevel;exit;
|
89 |
try {
|
90 |
+
$data['added_by']=$addedby;
|
91 |
$model->setData($data)->setId($id);
|
92 |
$model->save();
|
93 |
|
124 |
}
|
125 |
$this->_redirect('*/*/');
|
126 |
}
|
127 |
+
|
128 |
public function getPresentQtyAction(){
|
129 |
$product_id = $this->getRequest()->getParam('product_id');
|
130 |
|
135 |
|
136 |
|
137 |
echo $stocklevel;
|
138 |
+
}
|
139 |
+
|
140 |
+
/*
|
141 |
+
This function use for get SKU
|
142 |
+
*/
|
143 |
+
public function getSkuuAction(){
|
144 |
+
|
145 |
+
$product_id = $this->getRequest()->getParam('product_id');
|
146 |
+
|
147 |
+
$model = Mage::getModel('catalog/product');
|
148 |
+
$_product = $model->load($product_id);
|
149 |
+
$prdsku = $_product->getSku();
|
150 |
+
|
151 |
+
|
152 |
+
echo $prdsku;
|
153 |
}
|
154 |
|
155 |
|
app/code/local/Medma/Stockcontrol/controllers/Adminhtml/StockcontrolController.php~
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Medma_Stockcontrol_Adminhtml_StockcontrolController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
public function indexAction() {
|
6 |
+
|
7 |
+
|
8 |
+
$this->loadLayout();
|
9 |
+
$this->_setActiveMenu('catalog/stockcontrol');
|
10 |
+
//$this->_addBreadcrumb($this->__('Manage Grouped Product Discount Rule'), $this->__('Discount'));
|
11 |
+
$this->_addContent($this->getLayout()->createBlock('stockcontrol/adminhtml_stockcontrol'));
|
12 |
+
$this->renderLayout();
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
public function editAction() {
|
17 |
+
$id = $this->getRequest()->getParam('id');
|
18 |
+
|
19 |
+
$model = Mage::getModel('stockcontrol/stockcontrol')->load($id);
|
20 |
+
|
21 |
+
if ($model->getId() || $id == 0) {
|
22 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
23 |
+
if (!empty($data)) {
|
24 |
+
$model->setData($data);
|
25 |
+
}
|
26 |
+
|
27 |
+
Mage::register('stockcontrol_data', $model);
|
28 |
+
$this->loadLayout();
|
29 |
+
$this->_setActiveMenu('catalog/stockcontrol');
|
30 |
+
|
31 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
32 |
+
|
33 |
+
$this->_addContent($this->getLayout()->createBlock('stockcontrol/adminhtml_stockcontrol_edit'));
|
34 |
+
|
35 |
+
$this->renderLayout();
|
36 |
+
} else {
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Item does not exist'));
|
38 |
+
$this->_redirect('*/*/');
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
public function newAction() {
|
46 |
+
$this->editAction();
|
47 |
+
}
|
48 |
+
|
49 |
+
public function saveAction() {
|
50 |
+
$id= $this->getRequest()->getParam('id');
|
51 |
+
$user = Mage::getSingleton('admin/session');
|
52 |
+
$userId = $user->getUser()->getUserId();
|
53 |
+
$model_user= Mage::getModel('admin/user')->load($userId);
|
54 |
+
$addedby = $model_user['username'];
|
55 |
+
|
56 |
+
|
57 |
+
$model= Mage::getModel('stockcontrol/stockcontrol');
|
58 |
+
|
59 |
+
if ($data = $this->getRequest()->getPost()) {
|
60 |
+
if($data['operation']=='Stock In'){
|
61 |
+
$total_qty=$data['present_qty']+$data['added_qty'];
|
62 |
+
}elseif($data['operation']=='Stock Out'){
|
63 |
+
if($data['present_qty']<='0'){
|
64 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Quantity is less to perform Stock Out operation'));
|
65 |
+
$this->_redirect('*/*/');
|
66 |
+
return;
|
67 |
+
}else{
|
68 |
+
$total_qty=$data['present_qty']-$data['added_qty'];
|
69 |
+
}
|
70 |
+
}
|
71 |
+
$model_product= Mage::getModel('catalog/product');
|
72 |
+
$_product = $model_product->load($data['product_id']);
|
73 |
+
$stockData = $_product->getStockData();
|
74 |
+
$stockData['qty'] = $total_qty;
|
75 |
+
if($total_qty>0){
|
76 |
+
$stockData['is_in_stock'] = 1;
|
77 |
+
}else{
|
78 |
+
$stockData['is_in_stock'] = 0;
|
79 |
+
}
|
80 |
+
$_product->setStockData($stockData);
|
81 |
+
$_product->save();
|
82 |
+
$user = Mage::getSingleton('admin/session')->getData();
|
83 |
+
$userId = $user['user']['user_id'];
|
84 |
+
$data['total_qty']=$total_qty;
|
85 |
+
$data['added_by']=$userId ;
|
86 |
+
// $stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
87 |
+
// ->loadByProduct($_product)->getQty();
|
88 |
+
// echo $stocklevel;exit;
|
89 |
+
try {
|
90 |
+
$data['added_by']=$addedby;
|
91 |
+
$model->setData($data)->setId($id);
|
92 |
+
$model->save();
|
93 |
+
|
94 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('stockcontrol')->__('Quantity Update Operation Perform successfully'));
|
95 |
+
|
96 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
97 |
+
|
98 |
+
$this->_redirect('*/*/');
|
99 |
+
return;
|
100 |
+
} catch (Exception $e) {
|
101 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
102 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
103 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stockcontrol')->__('Unable to find item to save'));
|
108 |
+
$this->_redirect('*/*/');
|
109 |
+
}
|
110 |
+
public function deleteAction() {
|
111 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
112 |
+
try {
|
113 |
+
$model = Mage::getModel('stockcontrol/stockcontrol');
|
114 |
+
|
115 |
+
$model->setId($this->getRequest()->getParam('id'))
|
116 |
+
->delete();
|
117 |
+
|
118 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
119 |
+
$this->_redirect('*/*/');
|
120 |
+
} catch (Exception $e) {
|
121 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
122 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
123 |
+
}
|
124 |
+
}
|
125 |
+
$this->_redirect('*/*/');
|
126 |
+
}
|
127 |
+
|
128 |
+
public function getPresentQtyAction(){
|
129 |
+
$product_id = $this->getRequest()->getParam('product_id');
|
130 |
+
|
131 |
+
$model = Mage::getModel('catalog/product');
|
132 |
+
$_product = $model->load($product_id);
|
133 |
+
$stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
|
134 |
+
->loadByProduct($_product)->getQty();
|
135 |
+
|
136 |
+
|
137 |
+
echo $stocklevel;
|
138 |
+
}
|
139 |
+
|
140 |
+
/*
|
141 |
+
This function use for get sku
|
142 |
+
*/
|
143 |
+
public function getSkuuAction(){
|
144 |
+
|
145 |
+
$product_id = $this->getRequest()->getParam('product_id');
|
146 |
+
|
147 |
+
$model = Mage::getModel('catalog/product');
|
148 |
+
$_product = $model->load($product_id);
|
149 |
+
$prdsku = $_product->getSku();
|
150 |
+
|
151 |
+
|
152 |
+
echo $prdsku;
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
}
|
app/code/local/Medma/Stockcontrol/sql/stockcontrol_setup/mysql4-install-0.1.0.php
CHANGED
@@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('stockcontrol')} (
|
|
13 |
`present_qty` varchar(255) NOT NULL DEFAULT '',
|
14 |
`added_qty` varchar(255) NOT NULL DEFAULT '',
|
15 |
`total_qty` varchar(255) NOT NULL,
|
|
|
16 |
`qty_added_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
17 |
`added_by` varchar(255) NOT NULL,
|
18 |
PRIMARY KEY (`stock_id`)
|
13 |
`present_qty` varchar(255) NOT NULL DEFAULT '',
|
14 |
`added_qty` varchar(255) NOT NULL DEFAULT '',
|
15 |
`total_qty` varchar(255) NOT NULL,
|
16 |
+
`operation` varchar(255) NOT NULL,
|
17 |
`qty_added_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
18 |
`added_by` varchar(255) NOT NULL,
|
19 |
PRIMARY KEY (`stock_id`)
|
app/code/local/Medma/Stockcontrol/sql/stockcontrol_setup/mysql4-install-0.1.0.php~
CHANGED
@@ -7,14 +7,17 @@ $installer->startSetup();
|
|
7 |
$installer->run("
|
8 |
|
9 |
|
10 |
-
CREATE TABLE stockcontrol(
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
|
19 |
");
|
20 |
|
7 |
$installer->run("
|
8 |
|
9 |
|
10 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('stockcontrol')} (
|
11 |
+
`stock_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
12 |
+
`product_id` int(11) unsigned NOT NULL,
|
13 |
+
`present_qty` varchar(255) NOT NULL DEFAULT '',
|
14 |
+
`added_qty` varchar(255) NOT NULL DEFAULT '',
|
15 |
+
`total_qty` varchar(255) NOT NULL,
|
16 |
+
`operation` varchar(255) NOT NULL,
|
17 |
+
`qty_added_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
18 |
+
`added_by` varchar(255) NOT NULL,
|
19 |
+
PRIMARY KEY (`stock_id`)
|
20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
21 |
|
22 |
");
|
23 |
|
package.xml
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Medma_Stock_Control</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>This extension provides an additional feature for updating the stock of the products
|
10 |
-
<description>This extension provides an additional feature for updating the stock of the products
|
11 |
-
|
|
|
|
|
12 |
<authors><author><name>Medma Infomatix</name><user>Medma_Infomatix</user><email>gaurav@medma.in</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Medma"><dir name="Stockcontrol"><dir name="Block"><dir name="Adminhtml"><dir name="Stockcontrol"><dir name="Edit"><file name="Form.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Medma_Stock_Control</name>
|
4 |
+
<version>2.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>This extension provides an additional feature for updating the stock of the products.</summary>
|
10 |
+
<description>This extension provides an additional feature for updating the stock of the products in Magento Admin Panel.
|
11 |
+

|
12 |
+
This extension is mainly used where Stock updates are being done by other operators than the Admin. This extension also tracks which Admin user updated which products and this provides the facility for the Administrator to track the errors in Stock update.</description>
|
13 |
+
<notes>This is a latest release of the extension.</notes>
|
14 |
<authors><author><name>Medma Infomatix</name><user>Medma_Infomatix</user><email>gaurav@medma.in</email></author></authors>
|
15 |
+
<date>2013-01-23</date>
|
16 |
+
<time>06:23:07</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Medma"><dir name="Stockcontrol"><dir name="Block"><dir name="Adminhtml"><dir name="Stockcontrol"><dir name="Edit"><file name="Form.php" hash="acac90ea71e8bd6caf23b01d7cf0ab63"/><file name="Form.php~" hash="936434b73510746519da485925491e70"/><dir name="Tab"><file name="Form.php" hash="dfd11760871042496386ae18c5ae9bff"/><file name="Form.php~" hash="baa38642837860829ae4330426ae88bb"/></dir><file name="Tabs.php" hash="da26b4d3c6030d4c8ea46e3bfef42c07"/></dir><file name="Edit.php" hash="b8945c90063845a5c01e1ec9866e7e60"/><file name="Edit.php~" hash="df952cd927fc2d09253de57f3a505e72"/><file name="Grid.php" hash="8a129b2e4db041868f21ed68ff269c7d"/><file name="Grid.php~" hash="c1fe1bd9394a43f8c188075a59e92dd2"/></dir><file name="Stockcontrol.php" hash="26905c050ba2f9d49c521e676015acdc"/><file name="Stockcontrol.php~" hash="9db80488257bd92314be28ce7f3f8ece"/></dir><file name="Stockcontrol.php" hash="b27ea72a7b1a39c152c35dd40cb92666"/><file name="Stockcontrol.php~" hash="6843b73e90c114bf2de8545958c93947"/></dir><dir name="Helper"><file name="Data.php" hash="cd53ffe2d92f8ef59aef9ae6fc5f0e32"/><file name="Data.php~" hash="8ea6f23e9f926e8bafa179ab916057cf"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Stockcontrol"><file name="Collection.php" hash="c3514b030650f22f78b57c106c4ab0e5"/><file name="Collection.php~" hash="94baeb8e35cfe94c8e26a776c6974f33"/></dir><file name="Stockcontrol.php" hash="5c92de9f6d97358416e45bd10b8da1c1"/><file name="Stockcontrol.php~" hash="92cb8352ecd2d8726c0f892f2d3c2377"/></dir><file name="Stockcontrol.php" hash="abaa8b60c5557b28812e096bacd9f832"/><file name="Stockcontrol.php~" hash="b9dd52b6f70e8f54d5603307a60b19cb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="StockcontrolController.php" hash="891d25728408342c4cec49a5ffc65f4c"/><file name="StockcontrolController.php~" hash="a6bf5fffb04549de0580b28f195cff4b"/></dir></dir><dir name="etc"><file name="config.xml" hash="439f39b65053096cd1eb74b7ed398bce"/></dir><dir name="sql"><dir name="stockcontrol_setup"><file name="mysql4-install-0.1.0.php" hash="46b70cbc4d70cf057301f0ac35ecd919"/><file name="mysql4-install-0.1.0.php~" hash="efcb4ae5f95e3e50c6bbe53d71081f6a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Medma_Stockcontrol.xml" hash="5661fa743ccc78a1af4f0679d6685c29"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|