///
/// file này dành cho việc download plugin và hiển thị hóa đơn ajax
function create(htmlStr) {
var frag = document.createDocumentFragment(),
temp = document.createElement('div');
temp.innerHTML = htmlStr;
while (temp.firstChild) {
frag.appendChild(temp.firstChild);
}
return frag;
}
$(function () {
fragment = create('
' +
'
' +
'
' +
'
' +
'' +
'
' +
'' +
'
' +
'
' +
'
');
document.body.insertBefore(fragment, document.body.childNodes[0]);
});
//hien thi hoa don trong portal
function ajxCall4Portal(idInvoice, pattern) {
var jsondata = "idInvoice=" + idInvoice + "&pattern=" + pattern;
$.ajax({
type: "POST",
url: "/Invoice/ajxPreview/",
data: jsondata,
success: function (data) {
if (data.success == true) {
$('#container').html(data.str + "");
// them du lieu de hien thi cac button su kien : In + Ký Số + Tai về
var btnBar = '
';
// them du lieu de hien thi cac button su kien : In + Ký Số + Tai về
if (data.cusType === 1 && data.clientNotSign === true) {
btnBar += "";
}
btnBar += getToolbarHtml(idInvoice, pattern, data.attachFile, data.fKey, data.status, data.toolbarType);
btnBar += '
';
$('#invoice-footer').html(btnBar);
var fragment = create('')
document.body.insertBefore(fragment, document.body.childNodes[0]);
$('#ViewInvoice').modal('show');
$('.VATTEMP .invtable .prds').ProductNumberPagination({ number: data.rowPerData }, data);
if (data.status === 3 || data.status === 5)
addCanceledMark();
}
else {
sweetAlert("Thông báo", "Không có quyền xem hóa đơn này", "error");
}
},
error: function () {
}
});
}
function addCanceledMark() {
$('.VATTEMP').prepend('');
$('#imgCancel').css({ "position": "absolute", "z-index": "3", "width": "790px", "height": "800px" });
}
function getToolbarHtml(idInvoice, pattern, attachFile, fKey, status, toolbarType) {
if (typeof toolbarType === 'undefined' || toolbarType === null || toolbarType === '') {
return buildCommonToolbar(idInvoice, pattern, attachFile, fKey, status);
} else if (toolbarType === 'DA_LIEU') {
return buildDaLieuToolbar(idInvoice, pattern, attachFile, fKey, status);
}
}
function buildCommonToolbar(idInvoice, pattern, attachFile, fKey, status) {
var btnBar = "";
btnBar += "";
//btnBar += getDownloadPDFAndFileAttachButton(attachFile, idInvoice, pattern, fKey);
if (status !== -1 && status !== 0) {
btnBar += "";
if (status !== 3 && status !== 5) {
btnBar += "";
btnBar += "";
btnBar += '';
}
}
//if (attachFile) {
// btnBar += "";
//}
btnBar += " ";
return btnBar;
}
function buildDaLieuToolbar(idInvoice, pattern, attachFile, fKey, status) {
var btnBar = "";
//btnBar += "";
if (status !== -1 && status !== 0 & status !== 3 && status !== 5) {
btnBar += "";
btnBar += "";
btnBar += '';
}
btnBar += " ";
return btnBar;
}
function getDownloadPDFAndFileAttachButton(attachFile, idInvoice, pattern, fKey) {
var btnDropdown = '';
if (attachFile) {
btnDropdown += '