Barcode CODE_128 using PrintHTML with Qz Tray - qz-tray

Good Day All,
Right now, i'm trying to print using HTML with Qz-Tray. Can i make a barcode on that template HTML. The Problem is, that HTML template is STRING so it can not be change it using Javascript and I'm Trying to use Libre Font 128 Font Family but still not working.
https://www.w3schools.com/howto/tryit.asp?font=Libre%20Barcode%20128 i want to use that library, in this
function printHTML() {
var config = getUpdatedConfig();
var colA = '<h2>* QZ Print Plugin HTML Printing *</h2>' +
'<span style="color: #F00;">Version:</span> ' + qzVersion + '<br/>' +
'<span style="color: #F00;">Visit:</span> https://qz.io/';
var colB = '<img src="' + getPath() + '/assets/img/image_sample.png">';
var printData = [
{
type: 'html',
format: 'plain',
data: '<html>' +
' <table style="font-family: monospace; border: 1px;">' +
' <tr style="height: 6cm;">' +
' <td valign="top">' + colA + '</td>' +
' <td valign="top">' + colB + '</td>' +
' </tr>' +
' </table>' +
'</html>'
}
];
qz.print(config, printData).catch(displayError);
}
or this https://barcode-coder.com/en/barcode-jquery-plugin-201.html

Related

How to convert a T-SQL query into a Stored Procedure?

I am running SQL Server 2012 and I need to convert a T-SQL query into a Stored Procedure. My aim is to run a SQL job that will execute this Stored Procedure on a daily basis.
My T-SQL query stands as follows:
DECLARE #Body NVARCHAR(MAX),
#TableHead VARCHAR(1000),
#TableTail VARCHAR(1000)
SET #TableTail = '</table></body></html>' ;
SET #TableHead = '<html><head>' + '<style>'
+ 'td {border: solid black;border-width: 1px;padding-left:5px;padding-right:5px;padding-top:1px;padding-bottom:1px;font: 11px arial} '
+ '</style>' + '</head>' + '<body>' + 'Report generated on : '
+ CONVERT(VARCHAR(50), GETDATE(), 106)
+ ' <br> <table cellpadding=0 cellspacing=0 border=0>'
+ '<tr> <td bgcolor=#E6E6FA><b>StayYear</b></td>'
+ '<td bgcolor=#E6E6FA><b>Market</b></td>'
+ '<td bgcolor=#E6E6FA><b>Jan</b></td>'
+ '<td bgcolor=#E6E6FA><b>Feb</b></td>'
+ '<td bgcolor=#E6E6FA><b>Mar</b></td>'
+ '<td bgcolor=#E6E6FA><b>Apr</b></td>'
+ '<td bgcolor=#E6E6FA><b>May</b></td>'
+ '<td bgcolor=#E6E6FA><b>Jun</b></td>'
+ '<td bgcolor=#E6E6FA><b>Jul</b></td>'
+ '<td bgcolor=#E6E6FA><b>Aug</b></td>'
+ '<td bgcolor=#E6E6FA><b>Sep</b></td>'
+ '<td bgcolor=#E6E6FA><b>Oct</b></td>'
+ '<td bgcolor=#E6E6FA><b>Nov</b></td>'
+ '<td bgcolor=#E6E6FA><b>Dec</b></td>';
SET #Body = ( SELECT *
FROM View1
FOR XML RAW('tr'),
ELEMENTS
)
SELECT #Body = #TableHead + ISNULL(#Body, '') + #TableTail
What are the steps to convert the above into a Stored Procedure?
You Can add make your script as a Stored Procedure by simply binding your Query inside a Create Procedure statement. Like this
CREATE PROCEDURE <Database Schema>.<Procedue Name>
AS
BEGIN
<Your Script>
END
you can copy and paste your Query between the BEGIN and END.
Like this
CREATE PROCEDURE dbo.sProc_MyProc
AS
BEGIN
DECLARE #Body NVARCHAR(MAX),
#TableHead VARCHAR(1000),
#TableTail VARCHAR(1000)
SET #TableTail = '</table></body></html>' ;
SET #TableHead = '<html><head>' + '<style>'
+ 'td {border: solid black;border-width: 1px;padding-left:5px;padding-right:5px;padding-top:1px;padding-bottom:1px;font: 11px arial} '
+ '</style>' + '</head>' + '<body>' + 'Report generated on : '
+ CONVERT(VARCHAR(50), GETDATE(), 106)
+ ' <br> <table cellpadding=0 cellspacing=0 border=0>'
+ '<tr> <td bgcolor=#E6E6FA><b>StayYear</b></td>'
+ '<td bgcolor=#E6E6FA><b>Market</b></td>'
+ '<td bgcolor=#E6E6FA><b>Jan</b></td>'
+ '<td bgcolor=#E6E6FA><b>Feb</b></td>'
+ '<td bgcolor=#E6E6FA><b>Mar</b></td>'
+ '<td bgcolor=#E6E6FA><b>Apr</b></td>'
+ '<td bgcolor=#E6E6FA><b>May</b></td>'
+ '<td bgcolor=#E6E6FA><b>Jun</b></td>'
+ '<td bgcolor=#E6E6FA><b>Jul</b></td>'
+ '<td bgcolor=#E6E6FA><b>Aug</b></td>'
+ '<td bgcolor=#E6E6FA><b>Sep</b></td>'
+ '<td bgcolor=#E6E6FA><b>Oct</b></td>'
+ '<td bgcolor=#E6E6FA><b>Nov</b></td>'
+ '<td bgcolor=#E6E6FA><b>Dec</b></td>';
SET #Body = ( SELECT *
FROM View1
FOR XML RAW('tr'),
ELEMENTS
)
SELECT #Body = #TableHead + ISNULL(#Body, '') + #TableTail
END
Simply right-click 'Stored Procedures' and click 'Stored Procedure'.
A new window will open with some very basic code.
Delete the stuff in green
Name your Stored Procedure, with no spaces in the name of the SProc.
Paste your SQL script in between the BEGIN and END clauses.
Hit F5 to compile your Sproc.
If everything is setup correctly, you will get a message that reads
Command(s) completed successfully.

How to get compose view work with a InlineViewStrategy

I am trying to get a conpose view going in a InlineViewStrategy.
The simple , "hard coded" table view in a custom template works in the context of a higher level div tag ("x_content") as represented in the Vendor Spend for Maintain below passed into InlineViewStrategy
' <table class="" style="width:100%">',
' <tr>',
' <th style="width:37%;">',
' <p>Top 5</p>',
' </th>',
' <th>',
' <div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">',
' <p class="">Vendor</p>',
' </div>',
' <div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">',
' <p class="">Progress</p>',
' </div>',
' </th>',
' </tr>',
' <tr>',
' <td>',
' <canvas id="canvas1" height="140" width="140" style="margin: 15px 10px 10px 0"></canvas>',
' </td>',
' <td>',
' <table class="tile_info">',
' <tr>',
' <td>',
' <p><i class="fa fa-square blue"></i>Vendor 1 </p>',
' </td>',
' <td>30%</td>',
' </tr>',
' </table>',
' </td>',
' </tr>',
' </table>',
If I try to put the same content (verbatim wrapped with a template) in an html file (ie. test-view.html) and do a compose on test-view.html replacing the HTML with compose AND PASSING THAT to InLoneViewStrategy, I get a a blank screen
<compose view="./test-view.html"> </compose>
I get on the console, "Unhandled rejection Error: Load timeout for modules: template-registry-entry!test-view.html,text!test-view.html". Is there somewhere else that I should be putting this test-view.html? Or am I missing something?
to be more specific
[
' ... '
' <div class="x_content"> ',
' HTMLTABLE STUFF ',
' </div> '
' ... ].join( " ")
get replaced by
[
' ... '
' <div class="x_content"> ',
' <compose view="./test-view.html"> </compose>',
' </div> '
' ... ].join( " ")
in custom template which is then passed to InlineViewStrategy
Thanks, in advance your help.
test-view.html has to be in the relevant directory... in this case , at src level

kendo scheduler event template

Hi I would like to add a Kendo ToolTip inside the kendo Scheduler event template. When ever i add any Html helper it throws invalid template error. I might be missing some the syntax.Can anyone suggest the way to do it?
d.EventTemplate(
"<div style='height: auto !important;'>"+
"#=kendo.toString(start,'hh:mm')# #= kendo.toString(start,'tt')# #"+
"<span style='font-size:smaller'>#= PickStopName# </span> " +
"##(Html.Kendo().Tooltip().For('#Scheduler').Width(250)"+
".Content('# <div style='text-align:justify;'>" +
"<div>" +
"<h6> #= title# </h6>" +
"<h6> #= description# </h6>" +
"<h4> #= kendo.toString(start,'hh:mm')# </h4>" +
"</div>" +
"</div>)'#)#"+
"</div>"
);

Extjs 4.1.1 How to debug Xtemplete

I am using Ext 4.1.1 version.
I want to know How to debug the Xtemplate. i.e.
e.g.
'<tpl for="outerObject">',
'<tpl for="innerObject">',
'<span class="abc">{myValue}</span>',
'</tpl>',
'</tpl>',
Now I want to know what Value outerObject has, depending upon that want to loop into innerObject, and so on.
Please tell me any way to degug Xtemplate.
The easiest way is to get into the browser's debugger:
tpl: [
'<tpl for="outerObject">',
'{% debugger; %}'
'<tpl for="innerObject">',
'<span class="abc">{myValue}</span>',
'</tpl>',
'</tpl>'
]
You can execute arbitrary inline code in XTemplate. Hence, you can call console.log in order to print some object variable:
'{[console.log(values.outerObject)]}',
I know this is "old" but, if you have your own template or have anyway to come to the template, you can actually add the debugger; command and chrome will jump into the debugger.
extraRowTpl: [
'{%',
'values.view.rowBodyFeature.setupRowData(values.record, values.recordIndex, values);',
'debugger;', **<!-- WILL STOP HERE**
'this.nextTpl.applyOut(values, out, parent);',
'%}',
'<tr class="' + Ext.baseCSSPrefix + 'grid-rowbody-tr {rowBodyCls}">',
'<td class="' + Ext.baseCSSPrefix + 'grid-cell-rowbody' + ' ' + Ext.baseCSSPrefix + 'grid-cell ' + Ext.baseCSSPrefix + 'grid-td" colspan="{rowBodyColspan}">',
'<div class="' + Ext.baseCSSPrefix + 'grid-rowbody' + ' {rowBodyDivCls}">{rowBody}</div>',
'</td>',
'</tr>']
Hope I could help!
Greetz

Extjs 4: how to make a text field input to an editable div?

I have a text field (or time/date field) with mask. __:__:__ I have to change the color of "_" from black to white. Has Extjs 4 any solution to change input to (editable) div?
Have you tried overriding the base fieldSubTpl property for your field? I.e, adding the property with a as a div element instead of input:
fieldSubTpl: [ // note: {id} here is really {inputId}, but {cmpId} is available
'<div id="{id}" type="{type}" {inputAttrTpl}',
' size="1"', // allows inputs to fully respect CSS widths across all browsers
'<tpl if="name"> name="{name}"</tpl>',
'<tpl if="value"> value="{[Ext.util.Format.htmlEncode(values.value)]}"</tpl>',
'<tpl if="placeholder"> placeholder="{placeholder}"</tpl>',
'{%if (values.maxLength !== undefined){%} maxlength="{maxLength}"{%}%}',
'<tpl if="readOnly"> readonly="readonly"</tpl>',
'<tpl if="disabled"> disabled="disabled"</tpl>',
'<tpl if="tabIdx"> tabIndex="{tabIdx}"</tpl>',
'<tpl if="fieldStyle"> style="{fieldStyle}"</tpl>',
' class="{fieldCls} {typeCls} {editableCls}" autocomplete="off"/>',
{
disableFormats: true
}
],
Now I am here, using this tpl:
fieldSubTpl: [
'<div stlye="position: inherit; top: 0px; left: 0px" id="{id}-div" contentEditable='+!this.disableSel+' type="{type}" {inputAttrTpl}',
' size="1"',
'<tpl if="value"> value="{[Ext.util.Format.htmlEncode(values.value)]}"</tpl>',
'<tpl if="placeholder"> placeholder="{placeholder}"</tpl>',
'<tpl if="tabIdx"> tabIndex="{tabIdx}"</tpl>',
'<tpl if="fieldStyle"> style="{fieldStyle}"</tpl>',
' class="{fieldCls} {typeCls} {editableCls}" autocomplete="off">{[Ext.util.Format.htmlEncode(values.value)]}</div>' +
'<input type="text" id="{id}" value="{[Ext.util.Format.htmlEncode(values.value)]}" ' +
'style="visibility: hidden; height: 0px; width: 0px; " />',
{
disableFormats: true
}
]
And I made a new plugin extended the original, change all this.inputTextElement.value to get or set HTML
this.getPicker().on('select', function (p, r, o){
Ext.get(this.id + '-inputEl-div').setHTML(r.data.disp);
}, this);
And on some other event the hidden input and div change their values, but it's not the ultimate version of my sollution. Now I have lots of work yet... Huh... :)
And if you know other idea, please post it!
An other solution I'm trying:
buildDivsByFormat: function () {
// 12: 'h:i A', '03:15 PM'. 'h:i:s.u A' 24: 'H:i' 'H:i:s.u' instead.
var w = 8;
var divs = {};
if(this.format.indexOf("i") > -1)
divs.i = '<div style="padding:0px 0px 1px 0px;width:'+w*2+'px;min-width:'+w*2+'px;max-width:'+w*2+'px;float:left;display:inline-block;"' +
contentEditable="'+!this.disableSel+'" id="'+this.id+'-div-i'+'"> </div>';
... // making this with other format elements
var d = '';
var formatArray = this.format.split('');
for(var i = 0; i < formatArray.length; i = i + 1){
var currentChar = formatArray[i];
if(formatArray[i] === ":") currentChar = 'dp';
if(formatArray[i] === ".") currentChar = 'p';
if(formatArray[i] === " ") currentChar = 'sp';
d = d + divs[currentChar];
}
this.divs = d;
return d;
}
Making divs by format and inserting them to this tpl's div:
fieldSubTpl: [
'<div stlye="position: inherit; top: 0px; left: 0px" id="{id}-div" type="{type}" {inputAttrTpl}',
' size="1"',
'<tpl if="value"> value="{[Ext.util.Format.htmlEncode(values.value)]}"</tpl>',
'<tpl if="placeholder"> placeholder="{placeholder}"</tpl>',
'<tpl if="tabIdx"> tabIndex="{tabIdx}"</tpl>',
'<tpl if="fieldStyle"> style="{fieldStyle}"</tpl>',
' class="{fieldCls} {typeCls} {editableCls}" autocomplete="off">' +
'</div>' +
'<input type="text" id="{id}" value="{[Ext.util.Format.htmlEncode(values.value)]}" ' +
'style="visibility: hidden; height: 10px; width: 0px; " />',
{
disableFormats: true
}
]
Then I do some changing function... I have some problems: I can't coloring this version, but... bigger problem is: if input is visibility: hidden;, it makes space after my tpl's div... on display: none makes time picker to absolute 0 0 position of window, not to the field (div)... Has anybody an idea about this?