Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 379 | All time: 6,739 This week: 47 |
Version | License | PHP version | Categories | |||
d3codes 1.0 | Freeware | 7.2 | PHP 5, Graphics, Printing |
Description | Author | |||||||||||||||||||||||
This package can be used to generate barcodes and qrcodes for printing. Innovation Award
|
|
The preferred way to install this extension is through composer.
Either run
$ composer require d3yii2/d3codes "*"
or add
"d3yii2/d3codes": "*"
to the require
section of your composer.json
file.
'components' => [
'palletCodeRecorder' => [
'class' => 'd3yii2\d3codes\components\CodeRecorder',
'codeName' => 'pallets bar code',
'series' => [
'p01' => [
'prefix' => 'p01',
'length' => 5,
'from' => 1,
'to' => 20000
]
],
'modelClass' => 'wood\clasifiers\models\Pallet',
'componentsSysModel' => 'sysModel'
],
'codeReader' => [
'class' => 'd3yii2\d3codes\components\CodeReader',
'modelClassList' => [
'wood\clasifiers\models\Pallet'
],
'componentsSysModel' => 'sysModel'
],
]
For printing direct from the server. Use Chrome for converting to PDF and for sending to printer use PDFtoPrinter http://www.columbia.edu/~em36/pdftoprinter.html
To composer add repository https://github.com/uldisn/php-exec.git
"repositories": [
{
"type": "vcs",
"url": "https://github.com/uldisn/php-exec.git"
},
# Bar code printer
BOUNCER_PRINTER=BouncerPrinter
PDFtoPrinter=H:\yii2\cewood\PDFtoPrinter.exe
# chrome
CHROME_PATH=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
'components' => [
'bouncerPrinter' => [
'class' => '\d3yii2\d3codes\components\PrintWindowsPrinter',
'printerName' => getenv('BOUNCER_PRINTER'),
'chromeExe' => getenv('CHROME_PATH'),
'PDFtoPrinter' => getenv('PDFtoPrinter'),
],
]
$barCode = \Yii::$app->palletCodeRecorder->createNewRecord($palletModel->id);
$palletModel = \Yii::$app->palletCodeRecorder->codeReader($barcodeReadedByBarCodeScaner);
class BtlinePp extends BaseBtlinePp
{
public function rules()
{
return array_merge(parent::rules(),[
['code','safe']
]);
}
public function attributeLabels()
{
return array_merge(parent::attributeLabels(),[
'code' => 'Code'
]);
}
/
* @return string
* @throws D3ActiveRecordException
*/
public function getCode(): string
{
return Yii::$app->ppCodeRecorder->getCodeOrCreate($this->id);
}
}
use d3yii2\d3codes\actions\PrintCode;
class BatchController
{
public function actions() {
$OC = $this;
return [
'pp-print-barcode' => [
'class' => PrintCode::class,
'componentRecorderName' => 'ppCodeRecorder',
'layout' => '@layout_barcode',
'view' => 'print_barcode',
'data' => static function(int $id) use ($OC){
return [
'model' => $OC->findModel($id),
];
}
],
];
}
}
For form use model d3yii2\d3codes\models\CodeReader.
Controller
use d3yii2\d3codes\models\CodeReader;
$codeReaderModel = new CodeReader();
$codeReaderModel->componentCodeReaderName = 'codeReader';
$post = Yii::$app->request->post();
if($post && $codeReaderModel->load(Yii::$app->request->post())){
/ @var CwpalletPallet $palletModel */
$palletModel = $codeReaderModel->model;
}
if ($codeReaderModel->hasErrors()) {
FlashHelper::modelErrorSummary($codeReaderModel);
}
return $this->render('manufacturing', [
'packList' => $searchModel
->manufacturedPacks(true)
->all(),
'packId' => $packId,
'codeReaderModel' => $codeReaderModel
]);
form
$form = ActiveForm::begin([
'id' => 'BauncerCodeReading',
'enableClientValidation' => false,
'errorSummaryCssClass' => 'error-summary alert alert-error',
'fieldConfig' => [
'template' => "{label}\n{beginWrapper}\n{input}\n{error}\n{endWrapper}",
],
]);
echo $form
->field(
$codeReaderModel,
'code',
[
'inputOptions' => [
'autofocus' => 'autofocus',
'class' => 'form-control',
'tabindex' => '1'
]
])
->textInput()
->label('');
echo ThButton::widget([
'label' => 'Process',
'id' => 'saveCode',
'icon' => ThButton::ICON_CHECK,
'type' => ThButton::TYPE_SUCCESS,
'submit' => true,
'htmlOptions' => [
'name' => 'action',
'value' => 'save',
],
]);
ActiveForm::end();
try {
$url = Yii::$app->urlManager->createAbsoluteUrl([
'/cwstore/pack/print-barcode',
'id' => $id
]);
if(Yii::$app->bouncerPrinter->print($url)){
FlashHelper::addSuccess('Eti?ete nos?t?ta uz izsit?ja printera');
}else{
FlashHelper::addDanger('Rad?s k??da druk?jot eti?eti');
}
} catch (Exception $e) {
FlashHelper::processException($e);
}
Files (34) |
File | Role | Description | ||
---|---|---|---|---|
actions (2 files) | ||||
assetbundles (1 file) | ||||
assets (1 file) | ||||
components (4 files) | ||||
dictionaries (2 files) | ||||
doc (1 file) | ||||
gii (4 files) | ||||
migrations (2 files) | ||||
models (6 files, 1 directory) | ||||
views (1 directory) | ||||
composer.json | Data | Auxiliary data | ||
Module.php | Class | Class source | ||
README.md | Doc. | Documentation |
Files (34) | / | actions |
File | Role | Description |
---|---|---|
PrintCode.php | Class | Class source |
Read.php | Class | Class source |
Files (34) | / | components |
File | Role | Description |
---|---|---|
CodeReader.php | Class | Class source |
CodeRecorder.php | Class | Class source |
PrintWindowsPrinter.php | Class | Class source |
Serries.php | Class | Class source |
Files (34) | / | dictionaries |
File | Role | Description |
---|---|---|
D3CodesCodeDictionary.php | Class | Class source |
D3CodesSerriesDictionary.php | Class | Class source |
Files (34) | / | gii |
File | Role | Description |
---|---|---|
d3codes_codeGiiantModel.json | Data | Auxiliary data |
d3codes_code_queueGiiantModel.json | Data | Auxiliary data |
d3codes_code_recordGiiantModel.json | Data | Auxiliary data |
d3codes_seriesGiiantModel.json | Data | Auxiliary data |
Files (34) | / | migrations |
File | Role | Description |
---|---|---|
m200110_110707_init.php | Class | Class source |
m200208_190707_queue_create.php | Class | Class source |
Files (34) | / | models |
File | Role | Description | ||
---|---|---|---|---|
base (4 files) | ||||
CodeReader.php | Class | Class source | ||
D3CodesCode.php | Class | Class source | ||
D3CodesCodeQueue.php | Class | Class source | ||
D3CodesCodeRecord.php | Class | Class source | ||
D3CodesSeries.php | Class | Class source | ||
SysModels.php | Class | Class source |
Files (34) | / | models | / | base |
File | Role | Description |
---|---|---|
D3CodesCode.php | Class | Class source |
D3CodesCodeQueue.php | Class | Class source |
D3CodesCodeRecord.php | Class | Class source |
D3CodesSerries.php | Class | Class source |
Files (34) | / | views | / | layouts |
File | Role | Description |
---|---|---|
label.php | Example | Example script |
label_GodexBP500L_6X6.php | Example | Example script |
label_Micra106_12_95X150.php | Example | Example script |
label_simple.php | Example | Example script |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.