Notes
Notes - notes.io |
*
*/
Ext.application({
name : 'Fiddle',
launch : function() {
Ext.create('Ext.tab.Panel', {
activeTab: 0,
itemId:'root_invoices_tabpanel',
plain: true,
items: [
{
title: 'Invoices',
items:finaltab(),
}
],
renderTo : Ext.getBody()
});
}
});
function finaltab(){
return Ext.create('Ext.tab.Panel', {
// height:400,
// width:300,
activeTab: 0,
plain: true,
items: [
{
itemid: 'all_invoices_panel',
title: 'All Invoices',
bodyPadding: 10,
items:DisplayTab1(),
},
{
title: 'Open Invoices',
items : DisplayTab2()
},
{
title:'closed Invoices',
items : DisplayTab3()
}
],
});
}
function DisplayTab1(){
return Ext.create('Ext.panel.Panel', {
itemid:'all_invoices_panel',
items:[
buttonall1(),buttonall2(),buttonall3(),Display()
]
});
}
function Display(){
var itemsPerPage=15;
var store=Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
autoLoad:{start:0,limit:itemsPerPage},
pageSize: itemsPerPage,
proxy:{
type:'ajax',
url:'ServletUser.do',
reader:{
type:'json',
totalProperty:'results',
rootProperty:'rows',
successProperty:'success'
},
},
});
return Ext.create('Ext.grid.Panel', {
title: 'All INVOICES',
itemId: 'all_invoices_grid_panel',
id: 'all_invoices_grid_panel',
height: 525,
store: store,
columns:
[
{
text:'id',
dataIndex:'id'
},
{
text: 'account_id',
dataIndex: 'account_id'
}, {
text: 'document_number_norm',
dataIndex: 'document_number_norm'
}, {
text: 'company_code',
dataIndex: 'company_code'
}, {
text: 'fiscal_year',
dataIndex: 'fiscal_year'
}, {
text: 'branch',
dataIndex: 'branch'
}, {
text: 'customer_number_norm',
dataIndex: 'customer_number_norm'
}, {
text: 'fk_customer_map_id',
dataIndex: 'fk_customer_map_id'
}, {
text: 'document_date_norm',
dataIndex: 'document_date_norm'
}, {
text: 'baseline_date_norm',
dataIndex: 'baseline_date_norm'
}, {
text: 'due_date_norm',
dataIndex: 'due_date_norm'
}, {
text: 'invoice_number_norm',
dataIndex: 'invoice_number_norm'
}, {
text: 'open_amount_norm',
dataIndex: 'open_amount_norm'
}, {
text: 'payment_terms',
dataIndex: 'payment_terms'
}, {
text: 'clearing_date_norm',
dataIndex: 'clearing_date_norm'
}, {
text: 'isOpen',
dataIndex: 'isOpen'
}, {
text: 'order_type',
dataIndex: 'order_type'
}, {
text: 'order_date',
dataIndex: 'order_date'
}, {
text: 'business_area',
dataIndex: 'business_area'
}, {
text: 'ship_date',
dataIndex: 'ship_date'
}, {
text: 'job_id',
dataIndex: 'job_id'
}, {
text: 'tax_amt',
dataIndex: 'tax_amt'
}, {
text: 'current_disput_amount',
dataIndex: 'current_disput_amount'
}, {
text: 'ship_to',
dataIndex: 'ship_to'
}, {
text: 'document_id',
dataIndex: 'document_id'
}, {
text: 'document_date',
dataIndex: 'document_date'
}, {
text: 'actual_open_amount',
dataIndex: 'actual_open_amount'
}, {
text: 'due_date',
dataIndex: 'due_date'
}, {
text: 'invoice_age',
dataIndex: 'invoice_age'
}, {
text: 'isvalid_dispute',
dataIndex: 'isvalid_dispute'
}, {
text: 'posting_key',
dataIndex: 'posting_key'
}, {
text: 'strategy_id',
dataIndex: 'strategy_id'
}, {
text: 'currency',
dataIndex: 'currency'
}, {
text: 'debit_credit_indicator',
dataIndex: 'debit_credit_indicator'
}, {
text: 'valid_open_amount',
dataIndex: 'valid_open_amount'
}, {
text: 'customer_name',
dataIndex: 'customer_name'
},{
text:'create_user',
dataIndex:'create_user'
},{
text:'create_date',
dataIndex:'create_date'
},{
text:'update_user',
dataIndex:'update_user'
},{
text:'update_date',
dataIndex:'update_date'
}],
selModel: {selType: 'checkboxmodel'},
listeners:{
selectionchange: function(grid, selected){
if(selected.length === 1){
Ext.ComponentQuery.query('#all_invoices_edit_button')[0].setDisabled(false);}
else{
Ext.ComponentQuery.query('#all_invoices_edit_button')[0].setDisabled(true);
}
}
},
dockedItems: [
{
xtype:'pagingtoolbar',
store:'simpsonsStore',
dock:'bottom',
displayInfo: true
},{
xtype:'pagingtoolbar',
store:'simpsonsStore',
dock:'top',
displayInfo: true
}
],
});
}
function DisplayTab2(){
return Ext.create('Ext.panel.Panel', {
itemId:'panel2',
items:[
buttonopen1(),buttonopen2(),buttonopen3(),Display2()
]
});
}
function Display2(){
var itemsPerPage=15;
var store=Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore2',
// fields:[ 'name', 'email', 'phone'],
autoLoad:{start:0,limit:itemsPerPage},
pageSize: itemsPerPage,
proxy:{
type:'ajax',
url:'OpenInvoiceServlet.do',
reader:{
type:'json',
totalProperty:'results',
rootProperty:'rows',
successProperty:'success'
},
},
});
return Ext.create('Ext.grid.Panel', {
title: 'OPEN INVOICES',
itemId: 'open_invoices_grid_panel',
height: 525,
store: store,
columns: [
{
text:'id',
dataIndex:'id'
},
{
text: 'account_id',
dataIndex: 'account_id'
}, {
text: 'document_number_norm',
dataIndex: 'document_number_norm'
}, {
text: 'company_code',
dataIndex: 'company_code'
}, {
text: 'fiscal_year',
dataIndex: 'fiscal_year'
}, {
text: 'branch',
dataIndex: 'branch'
}, {
text: 'customer_number_norm',
dataIndex: 'customer_number_norm'
}, {
text: 'fk_customer_map_id',
dataIndex: 'fk_customer_map_id'
}, {
text: 'document_date_norm',
dataIndex: 'document_date_norm'
}, {
text: 'baseline_date_norm',
dataIndex: 'baseline_date_norm'
}, {
text: 'due_date_norm',
dataIndex: 'due_date_norm'
}, {
text: 'invoice_number_norm',
dataIndex: 'invoice_number_norm'
}, {
text: 'open_amount_norm',
dataIndex: 'open_amount_norm'
}, {
text: 'payment_terms',
dataIndex: 'payment_terms'
}, {
text: 'clearing_date_norm',
dataIndex: 'clearing_date_norm'
}, {
text: 'isOpen',
dataIndex: 'isOpen'
}, {
text: 'order_type',
dataIndex: 'order_type'
}, {
text: 'order_date',
dataIndex: 'order_date'
}, {
text: 'business_area',
dataIndex: 'business_area'
}, {
text: 'ship_date',
dataIndex: 'ship_date'
}, {
text: 'job_id',
dataIndex: 'job_id'
}, {
text: 'tax_amt',
dataIndex: 'tax_amt'
}, {
text: 'current_disput_amount',
dataIndex: 'current_disput_amount'
}, {
text: 'ship_to',
dataIndex: 'ship_to'
}, {
text: 'document_id',
dataIndex: 'document_id'
}, {
text: 'document_date',
dataIndex: 'document_date'
}, {
text: 'actual_open_amount',
dataIndex: 'actual_open_amount'
}, {
text: 'due_date',
dataIndex: 'due_date'
}, {
text: 'invoice_age',
dataIndex: 'invoice_age'
}, {
text: 'isvalid_dispute',
dataIndex: 'isvalid_dispute'
}, {
text: 'posting_key',
dataIndex: 'posting_key'
}, {
text: 'strategy_id',
dataIndex: 'strategy_id'
}, {
text: 'currency',
dataIndex: 'currency'
}, {
text: 'debit_credit_indicator',
dataIndex: 'debit_credit_indicator'
}, {
text: 'valid_open_amount',
dataIndex: 'valid_open_amount'
}, {
text: 'customer_name',
dataIndex: 'customer_name'
},{
text:'create_user',
dataIndex:'create_user'
},{
text:'create_date',
dataIndex:'create_date'
},{
text:'update_user',
dataIndex:'update_user'
},{
text:'update_date',
dataIndex:'update_date'
}],
selModel: {selType: 'checkboxmodel'},
listeners:{
selectionchange: function(grid, selected){
if(selected.length === 1){
Ext.ComponentQuery.query('#open_invoices_edit_button')[0].setDisabled(false);}
else{
Ext.ComponentQuery.query('#open_invoices_edit_button')[0].setDisabled(true);
}
}
},
dockedItems: [
{
xtype:'pagingtoolbar',
store:'simpsonsStore2',
dock:'bottom',
displayInfo: true
},{
xtype:'pagingtoolbar',
store:'simpsonsStore2',
dock:'top',
displayInfo: true
},
],
});
}
function DisplayTab3(){
return Ext.create('Ext.panel.Panel', {
itemid:'close_invoices_panel',
items:[
buttonclose1(),buttonclose3(),Display3()
]
});
}
function Display3(){
var itemsPerPage=15;
var store=Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore3',
autoLoad:{start:0,limit:itemsPerPage},
pageSize: itemsPerPage,
proxy:{
type:'ajax',
url:'closeServletUser.do',
reader:{
type:'json',
totalProperty:'results',
rootProperty:'rows',
successProperty:'success'
},
},
});
return Ext.create('Ext.grid.Panel', {
title: 'ClOSE INVOICES',
itemId: 'close_invoices_grid_panel',
id: 'close_invoices_grid_panel',
height: 525,
store: store,
columns:
[
{
text:'id',
dataIndex:'id'
},
{
text: 'account_id',
dataIndex: 'account_id'
}, {
text: 'document_number_norm',
dataIndex: 'document_number_norm'
}, {
text: 'company_code',
dataIndex: 'company_code'
}, {
text: 'fiscal_year',
dataIndex: 'fiscal_year'
}, {
text: 'branch',
dataIndex: 'branch'
}, {
text: 'customer_number_norm',
dataIndex: 'customer_number_norm'
}, {
text: 'fk_customer_map_id',
dataIndex: 'fk_customer_map_id'
}, {
text: 'document_date_norm',
dataIndex: 'document_date_norm'
}, {
text: 'baseline_date_norm',
dataIndex: 'baseline_date_norm'
}, {
text: 'due_date_norm',
dataIndex: 'due_date_norm'
}, {
text: 'invoice_number_norm',
dataIndex: 'invoice_number_norm'
}, {
text: 'open_amount_norm',
dataIndex: 'open_amount_norm'
}, {
text: 'payment_terms',
dataIndex: 'payment_terms'
}, {
text: 'clearing_date_norm',
dataIndex: 'clearing_date_norm'
}, {
text: 'isOpen',
dataIndex: 'isOpen'
}, {
text: 'order_type',
dataIndex: 'order_type'
}, {
text: 'order_date',
dataIndex: 'order_date'
}, {
text: 'business_area',
dataIndex: 'business_area'
}, {
text: 'ship_date',
dataIndex: 'ship_date'
}, {
text: 'job_id',
dataIndex: 'job_id'
}, {
text: 'tax_amt',
dataIndex: 'tax_amt'
}, {
text: 'current_disput_amount',
dataIndex: 'current_disput_amount'
}, {
text: 'ship_to',
dataIndex: 'ship_to'
}, {
text: 'document_id',
dataIndex: 'document_id'
}, {
text: 'document_date',
dataIndex: 'document_date'
}, {
text: 'actual_open_amount',
dataIndex: 'actual_open_amount'
}, {
text: 'due_date',
dataIndex: 'due_date'
}, {
text: 'invoice_age',
dataIndex: 'invoice_age'
}, {
text: 'isvalid_dispute',
dataIndex: 'isvalid_dispute'
}, {
text: 'posting_key',
dataIndex: 'posting_key'
}, {
text: 'strategy_id',
dataIndex: 'strategy_id'
}, {
text: 'currency',
dataIndex: 'currency'
}, {
text: 'debit_credit_indicator',
dataIndex: 'debit_credit_indicator'
}, {
text: 'valid_open_amount',
dataIndex: 'valid_open_amount'
}, {
text: 'customer_name',
dataIndex: 'customer_name'
},{
text:'create_user',
dataIndex:'create_user'
},{
text:'create_date',
dataIndex:'create_date'
},{
text:'update_user',
dataIndex:'update_user'
},{
text:'update_date',
dataIndex:'update_date'
}],
selModel: {selType: 'checkboxmodel'},
listeners:{
selectionchange: function(grid, selected){
if(selected.length === 1){
Ext.ComponentQuery.query('#close_invoices_edit_button')[0].setDisabled(false);}
else{
Ext.ComponentQuery.query('#close_invoices_edit_button')[0].setDisabled(true);
}
}
},
dockedItems: [
{
xtype:'pagingtoolbar',
store:'simpsonsStore',
dock:'bottom',
displayInfo: true
},{
xtype:'pagingtoolbar',
store:'simpsonsStore',
dock:'top',
displayInfo: true
}
],
});
}
function editForm(id,jobId,shipTo){
return Ext.create('Ext.form.Panel',{
itemId:'all_invoices_edit_panel',
id:'all_invoices_edit_panel',
items:[
{
xtype:'textfield',
itemId:'all_invoices_jobid',
id:'all_invoices_job_id',
value:jobId,
name:'jobid',
allowBlank:false,
fieldLabel:'Job Id'
},
{
xtype:'textfield',
id:'all_invoices_ship_to',
itemId:'all_invoices_shipto',
value:shipTo,
name:'shipto',
allowBlank:false,
fieldLabel:'Ship To'
}
],
buttons: [{
text: 'Save',
itemId:'all_invoices_save_edit',
formBind: true,
// disabled:true,
handler: function()
{
//var id=Ext.getCmp('all_invoices_grid_panel').selection()[0].getValue();
jobId1 = Ext.ComponentQuery.query('#all_invoices_edit_panel')[0].getForm().findField("all_invoices_job_id").getValue();
shipTo1 = Ext.ComponentQuery.query('#all_invoices_edit_panel')[0].getForm().findField("all_invoices_ship_to").getValue();
//const formData=this.up('form').getValues()
//jobId= formData['job-id-inputE1'];
//shipTo= formData['ship-to-inputE1'];
//var id = Ext.ComponentQuery.query('#all_invoices_grid_panel')[0].getSelectionModel().getSelected().items[0].data.id;
//var job = Ext.ComponentQuery.query('#all_invoices_grid_panel')[0].getSelectionModel().getSelected().items[0].data.job_id;
//var ship= Ext.ComponentQuery.query('#all_invoices_grid_panel')[0].getSelectionModel().getSelected().items[0].data.ship_to;
// Ext.ComponentQuery.query('#all_invoices_job_id')[0].setValue(job);
// Ext.ComponentQuery.query('#all_invoices_ship_to')[0].setValue(ship);
console.log(jobId1+'hi'+shipTo1);
editButtonRequest(id,jobId1,shipTo1,'saveEdit.do');
}
},{
text:'Cancel',
itemId:'all_invoices_cancel_edit',
handler: function(){this.up('.window').close();}
}],
buttonAlign:'center',
});
}
function win(id,jobId,shipTo) {
return Ext.create('Ext.window.Window',{
title:'Edit',
layout:'form',
width:400,
closeAction:'close',
//target : document.getElementById('buttonId'),
plain: true,
items:[
editForm(id,jobId,shipTo)
]
});
}
function buttonall1(){
return Ext.create('Ext.Button', {
text: 'Edit',
itemId:'all_invoices_edit_button',
disabled: true,
handler: function() {
//Ext.Msg.alert('@','editbutton');
const selectAllInvoices = Ext.ComponentQuery.query('#all_invoices_grid_panel')[0].getSelectionModel().getSelection();
if(selectAllInvoices.length == 1)
{
const id = selectAllInvoices[0].data["id"];
const jobId= selectAllInvoices[0].data["job_id"];
const shipTo= selectAllInvoices[0].data["ship_to"];
console.log(jobId+'hi'+shipTo);
win(id,jobId,shipTo).show();
}
}
});
}
function buttonall2(){
return Ext.create('Ext.Button', {
text: 'Predict',
itemid:'all_invoices_predict_button',
listeners:{
click:function() {var mlRequestJSON={};
mlRequestJSON.id='1605530';
var gridPanel= Ext.ComponentQuery.query('#all_invoices_grid_panel')[0];
mlRequestJSON.data=getJsonData(gridPanel);
Ext.Ajax.request({
url:'http://127.0.0.1:5000/predict',
method:'POST',
headers:{
'Content-Type':'application/text',
'Access-Control-Allow-Origin':'*'
},
params:{
data: JSON.stringify(mlRequestJSON),
},
success: function(result, request){
console.log(Ext.decode(result.responseText))
},
failure: function(result, request){
Ext.Msg.alert('Warning','Error');
}
});
}
}
});
}
function buttonall3(){
return Ext.create('Ext.Button', {
text: 'Advanced Search',
align:'right',
// margin:'0 0 0 1000',
itemid:'all_invoices_advancesearch_button',
menu: new Ext.menu.Menu({
items:[{
xtype:'panel',
width:650,
height:220,
title:'Advanced Search',
padding:10,
items:[{
xtype:'panel',
layout:'hbox',
padding:10,
items:[{
xtype:'datefield',
fieldLabel:'Due Date',
margin:5
},{
xtype:'combobox',
fieldLabel:'Fiscal Year',
margin:5
}]
},
{
xtype:'panel',
layout:'hbox',
padding: 10,
items:[{
xtype:'numberfield',
fieldLabel:'Actual Open Amount',
margin:5
},{
xtype:'textfield',
fieldLabel:'Customer Name',
margin:5
}
]
},{
xtype:'button',
text:'Search',
padding:5,
margin:2
},{
xtype:'button',
text:'Clear',
margin:2,
padding:5
}]
}]
})
});
}
function buttonopen1(){
return Ext.create('Ext.Button', {
text: 'Edit',
disabled: true,
itemId:'open_invoices_edit_button',
handler: function() {
win().show();
}
});
}
function buttonopen2(){
return Ext.create('Ext.Button', {
text: 'Predict',
itemId:'open_invoices_predict_button',
handler: function() {}
});
}
function buttonopen3(){
return Ext.create('Ext.Button', {
text: 'Advanced Search',
itemid:'open_invoices_search_button',
handler: function() {}
});
}
function buttonclose1(){
return Ext.create('Ext.Button', {
text: 'Edit',
disabled: true,
itemId:'close_invoices_edit_button',
handler: function() {
win().show();
}
});
}
function buttonclose3(){
return Ext.create('Ext.Button', {
text: 'Advanced Search',
itemId:'close_invoices_search_button',
handler: function() {}
});
}
function editButtonRequest(id,jobId1,shipTo1,link){
Ext.Ajax.request({
url:link,
method:'POST',
params:{
id,
jobId1,
shipTo1
},
success: function(result,request){
Ext.MessageBox.alert('Success','updated successfully');
},
failure: function(result,request){
Ext.MessageBox.alert('Failed','update failed');
}
})
}
function getJsonData(gridPanel){
var storeData= gridPanel.getSelectionModel().getSelected();
var invoices=[];
for(var i=0;i<storeData.length;i++){
invoices.push(storeData.items[i].data);
}
return invoices;
} here ...
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team