First create solution
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
Nuvolar_Scanner_Android.Discount = function (params) {
|
||||
priceValidationRules = {
|
||||
validationRules: [{
|
||||
type: "range",
|
||||
min: 1,
|
||||
message: "A leértékelt ár nem lehet 0"
|
||||
}]
|
||||
};
|
||||
var viewModel = {
|
||||
onEnterKeyBarcode: function (e) {
|
||||
SimpleQuery.UserName = username();
|
||||
SimpleQuery.Password = password();
|
||||
SimpleQuery.Database = database();
|
||||
SimpleQuery.Query = 'DX_GetProductsInfo_dxDatagrid;' + Barcode();
|
||||
JSON_Text = JSON.stringify(SimpleQuery, null);
|
||||
$.getJSON(URL(), 'id=' + JSON_Text, function (results) {
|
||||
dataSourcePDARows = JSON.parse(JSON.parse(results).Result);
|
||||
$("#gridContainer").dxDataGrid({ dataSource: dataSourcePDARows });
|
||||
if (dataSourcePDARows.length > 1) {
|
||||
BarcodeDisabled(true);
|
||||
DiscountCancelVisible(true);
|
||||
DiscountOkVisible(true);
|
||||
}
|
||||
else {
|
||||
Barcode("");
|
||||
DiscountCancelVisible(false);
|
||||
DiscountOkVisible(false);
|
||||
}
|
||||
$("#BarcodeText").dxTextBox("instance").focus();
|
||||
}).done(function () {
|
||||
//alert("second success");
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
DevExpress.ui.notify("Kapcsolati hiba, próbálja meg újra!", "error", 2000);
|
||||
});
|
||||
SimpleQuery.UserName = username();
|
||||
SimpleQuery.Password = password();
|
||||
SimpleQuery.Database = database();
|
||||
SimpleQuery.Query = 'DX_GetDiscountInfo_dxDatagrid;' + Barcode();
|
||||
JSON_Text = JSON.stringify(SimpleQuery, null);
|
||||
$.getJSON(URL(), 'id=' + JSON_Text, function (results) {
|
||||
dataSourceDiscount = JSON.parse(JSON.parse(results).Result);
|
||||
$("#gridContainerDiscount").dxDataGrid({ dataSource: dataSourceDiscount });
|
||||
}).done(function () {
|
||||
//alert("second success");
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
DevExpress.ui.notify("Kapcsolati hiba, próbálja meg újra!", "error", 2000);
|
||||
});
|
||||
},
|
||||
onClickOk: function (e) {
|
||||
var result = e.validationGroup.validate();
|
||||
if (result.isValid) {
|
||||
SimpleQuery.UserName = username();
|
||||
SimpleQuery.Password = password();
|
||||
SimpleQuery.Database = database();
|
||||
SimpleQuery.Query = 'DX_InsertDiscount_dxDataGrid;' + Barcode() + ';' + PriceBruttoHUF() + ';' + ActualDate.yyyymmdd() + ';' + ExpirationDate.yyyymmdd();
|
||||
JSON_Text = JSON.stringify(SimpleQuery, null);
|
||||
$.getJSON(URL(), 'id=' + JSON_Text, function (results) {
|
||||
dataSourceDiscount = JSON.parse(JSON.parse(results).Result);
|
||||
$("#gridContainerDiscount").dxDataGrid({ dataSource: dataSourceDiscount });
|
||||
Barcode("");
|
||||
DiscountCancelVisible(false);
|
||||
DiscountOkVisible(false);
|
||||
BarcodeDisabled(false);
|
||||
$("BarcodeText").dxTextBox("instance").focus();
|
||||
}).done(function () {
|
||||
//alert("second success");
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
DevExpress.ui.notify("Kapcsolati hiba, próbálja meg újra!", "error", 2000);
|
||||
});
|
||||
}
|
||||
},
|
||||
onClickCancel: function (e) {
|
||||
BarcodeDisabled(false);
|
||||
DiscountCancelVisible(false);
|
||||
DiscountOkVisible(false);
|
||||
Barcode("");
|
||||
},
|
||||
viewShown: function (e) {
|
||||
dataSourcePDARows = null;
|
||||
if (IsLoggedOn == false) {
|
||||
currentnavigate("Discount");
|
||||
Nuvolar_Scanner_Android.app.navigate("Login", { root: true });
|
||||
}
|
||||
else {
|
||||
$("#gridContainer").dxDataGrid({
|
||||
dataSource: dataSourcePDARows,
|
||||
allowColumnReordering: true,
|
||||
allowColumnResizing: true,
|
||||
columnAutoWidth: true,
|
||||
rowAlternationEnabled: true,
|
||||
columnChooser: {
|
||||
enabled: false
|
||||
},
|
||||
scrolling: { mode: 'infinite' },
|
||||
columnFixing: {
|
||||
enabled: true
|
||||
},
|
||||
columns: [{
|
||||
dataField: "Oid",
|
||||
visible: false,
|
||||
key: true
|
||||
},
|
||||
{ dataField: "ShortName", caption: 'Megnevezés' },
|
||||
{ dataField: "Value", caption: 'Érték' }
|
||||
]
|
||||
});
|
||||
$("#gridContainerDiscount").dxDataGrid({
|
||||
dataSource: dataSourceDiscount,
|
||||
allowColumnReordering: true,
|
||||
allowColumnResizing: true,
|
||||
columnAutoWidth: true,
|
||||
rowAlternationEnabled: true,
|
||||
columnChooser: {
|
||||
enabled: false
|
||||
},
|
||||
scrolling: { mode: 'infinite' },
|
||||
columnFixing: {
|
||||
enabled: true
|
||||
},
|
||||
columns: [{
|
||||
dataField: "Oid",
|
||||
visible: false,
|
||||
key: true
|
||||
},
|
||||
{ dataField: "Barcode", caption: 'Vonalkód' },
|
||||
{ dataField: "PriceBruttoHUF", caption: 'Bruttó ár' },
|
||||
{ dataField: "ExpirationDate", caption: 'Érvényes' }
|
||||
]
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
return viewModel;
|
||||
};
|
||||
Reference in New Issue
Block a user