|
|
@@ -38,6 +38,7 @@ const Index = () => { |
|
|
|
}); |
|
|
|
const [onReady] = React.useState(true); |
|
|
|
const [onDownload, setOnDownload] = React.useState(false); |
|
|
|
const [onView, setOnView] = React.useState(false); |
|
|
|
|
|
|
|
// React.useEffect(() => { |
|
|
|
// setOnReady(true); |
|
|
@@ -51,47 +52,58 @@ const Index = () => { |
|
|
|
}, [searchCriteria]); |
|
|
|
|
|
|
|
function loadGrid(){ |
|
|
|
setOnView(true) |
|
|
|
HttpUtils.get({ |
|
|
|
url: UrlUtils.VIEW_RECON_REPORT, |
|
|
|
params: searchCriteria, |
|
|
|
onSuccess: function(responseData){ |
|
|
|
console.log(responseData) |
|
|
|
var myWindow = window.open(); |
|
|
|
myWindow.document.write(responseData); |
|
|
|
// console.log(responseData) |
|
|
|
if(responseData.status != 200){ |
|
|
|
alert(responseData.content) |
|
|
|
setOnView(false) |
|
|
|
} else { |
|
|
|
var myWindow = window.open(); |
|
|
|
myWindow.document.write(responseData.content); |
|
|
|
setOnView(false) |
|
|
|
} |
|
|
|
}, |
|
|
|
onError: function(){ |
|
|
|
console.log("error") |
|
|
|
onError:()=>{ |
|
|
|
setOnView(false) |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// axios.get(UrlUtils.VIEW_RECON_REPORT, { |
|
|
|
// params: searchCriteria |
|
|
|
// }).then( |
|
|
|
// (response) => { |
|
|
|
// console.log(response) |
|
|
|
// var myWindow = window.open(); |
|
|
|
// myWindow.document.write(response); |
|
|
|
// } |
|
|
|
// ).catch((error) => { |
|
|
|
// console.log(error); |
|
|
|
// // return handleError(error, onError); |
|
|
|
// }); |
|
|
|
} |
|
|
|
|
|
|
|
function downloadXML(input) { |
|
|
|
// console.log(input) |
|
|
|
setOnDownload(true) |
|
|
|
HttpUtils.fileDownload({ |
|
|
|
url: UrlUtils.GEN_RECON_REPORT, |
|
|
|
params:input, |
|
|
|
onResponse:(response)=>{ |
|
|
|
console.log(response) |
|
|
|
setOnDownload(false) |
|
|
|
}, |
|
|
|
onError:()=>{ |
|
|
|
setOnDownload(false) |
|
|
|
} |
|
|
|
}); |
|
|
|
console.log(input) |
|
|
|
const hasCollRange = input.CollDateFrom!="" && input.CollDateTo!=""; |
|
|
|
const hasTxnRange = input.TxnDateFrom!="" && input.TxnDateTo!=""; |
|
|
|
const hasSysTxnRange = input.SysTxnDateFrom!="" && input.SysTxnDateTo!=""; |
|
|
|
|
|
|
|
let countRanges= 0; |
|
|
|
if(hasCollRange) countRanges+=1; |
|
|
|
if(hasTxnRange) countRanges+=1; |
|
|
|
if(hasSysTxnRange) countRanges+=1; |
|
|
|
|
|
|
|
if(countRanges>1){ |
|
|
|
alert("Only one date range is allowed Trans/Coll dates") |
|
|
|
// return "<div>Only one date range is allowed Trans/Coll dates</div>"; |
|
|
|
}else if(countRanges == 0){ |
|
|
|
alert("Must have a date range") |
|
|
|
// return "<div>must have a date range</div>"; |
|
|
|
}else{ |
|
|
|
setOnDownload(true) |
|
|
|
HttpUtils.fileDownload({ |
|
|
|
url: UrlUtils.GEN_RECON_REPORT, |
|
|
|
params:input, |
|
|
|
onResponse:(response)=>{ |
|
|
|
console.log(response) |
|
|
|
setOnDownload(false) |
|
|
|
}, |
|
|
|
onError:()=>{ |
|
|
|
setOnDownload(false) |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// open(UrlUtils.GEN_GFMIS_XML + "/today?online=true") |
|
|
|
} |
|
|
|
|
|
|
@@ -125,6 +137,7 @@ const Index = () => { |
|
|
|
generateReport={generateReport} |
|
|
|
searchCriteria={searchCriteria} |
|
|
|
onDownload={onDownload} |
|
|
|
onView={onView} |
|
|
|
/> |
|
|
|
</Grid> |
|
|
|
{/*row 2*/} |
|
|
|