jueves, 7 de junio de 2012

Crear Diario de inv


static void TestCrearDiarioInventario(Args _args)
{
    GsInventJournalTService GsInventJournalTService;
    GsInventJournalT GsInventJournalT;


    GsInventJournalT_InventJournalTable_1 GsInventJournalT_InventJournalTable_1;
    GsInventJournalT_InventJournalTrans_1 GsInventJournalT_InventJournalTrans_1;
 
    GsInventJournalT_InventDim_1 GsInventJournalT_InventDim_1;

    AifMultiTypeAccount AifMultiTypeAccount;

    AifDimensionAttributeValueSet AifDimensionAttributeValueSet= new AifDimensionAttributeValueSet();
    AifDimensionAttributeValue          dimensionAttributeValue;
    AfStronglyTypedDataContainerList    dimensionAttributeValues;
    #AifDimensionDataContainerTypes
    AifLedgerAccount AifLedgerAccount;
    ;
 
   GsInventJournalTService=GsInventJournalTService::construct();
   GsInventJournalT=new GsInventJournalT();
   GsInventJournalT.createInventJournalTable_1().addNew();
   GsInventJournalT_InventJournalTable_1=GsInventJournalT.parmInventJournalTable_1().addNew();
 
    GsInventJournalT_InventJournalTable_1.parmJournalNameId("Mov");
 
    GsInventJournalT_InventJournalTable_1.createInventJournalTrans_1();
    GsInventJournalT_InventJournalTrans_1=GsInventJournalT_InventJournalTable_1.parmInventJournalTrans_1().addNew();
 
    GsInventJournalT_InventJournalTrans_1.parmItemId("CIC00731400A36");
    GsInventJournalT_InventJournalTrans_1.parmQty(1);
    GsInventJournalT_InventJournalTrans_1.parmCostPrice(100);
    GsInventJournalT_InventJournalTrans_1.parmCostAmount(100);
 
    AifLedgerAccount=new AifLedgerAccount();
    AifLedgerAccount.parmDisplayValue("51100001");
    AifLedgerAccount.parmMainAccount("51100001");
 
    GsInventJournalT_InventJournalTrans_1.parmLedgerDimension(AifLedgerAccount);
 
    dimensionAttributeValues = new AfStronglyTypedDataContainerList(#AifDimensionAttributeValue);

    dimensionAttributeValue = dimensionAttributeValues.addNew();
    dimensionAttributeValue.parmName("Sucursal");
    dimensionAttributeValue.parmValue("QRO");

    dimensionAttributeValue = dimensionAttributeValues.addNew();
    dimensionAttributeValue.parmName("División");
    dimensionAttributeValue.parmValue("ABINSA");
    AifDimensionAttributeValueSet.parmValues(dimensionAttributeValues);
    GsInventJournalT_InventJournalTrans_1.parmDefaultDimension(AifDimensionAttributeValueSet);
 
    GsInventJournalT_InventJournalTrans_1.createInventDim_1();
    GsInventJournalT_InventDim_1=GsInventJournalT_InventJournalTrans_1.parmInventDim_1().addNew();
 
    GsInventJournalT_InventDim_1.parmInventSizeId("GM");
    GsInventJournalT_InventDim_1.parmInventColorId("110");
    GsInventJournalT_InventDim_1.parmInventSiteId("130");
    GsInventJournalT_InventDim_1.parmInventLocationId("MP 130");
    GsInventJournalT_InventDim_1.parmInventBatchId("1");
    GsInventJournalT_InventDim_1.parmWMSLocationId("E1");
 
 
 
    GsInventJournalTService.create(GsInventJournalT);
 
 
 
 
 
 

}

miércoles, 6 de junio de 2012

Mostrar Código de Barras Horizontal



static container MostrarBarCodeHorizontal()
{
System.Drawing.Bitmap   BarcodeBitmap;

System.Drawing.Graphics BarcodeGraphics;

int     dx=350;
int     dy=30;

str     barcodetxt;
Image   BarcodeImage;

System.Drawing.Pen                TxtPen;
System.Drawing.Brush              TxtBrush;

System.Drawing.Brush              DrawBrush;

System.Drawing.StringFormat       StringFormat;
System.Drawing.StringAlignment    StringAlignment;

System.Drawing.Font BarcodeFont = new System.Drawing.Font('BC C128 Medium',22,System.Drawing.FontStyle::Regular);

Int64             BarcodeBitmapPtr;
//BarcodeCode39    MyBarcode = BarcodeCode39::construct();
BarcodeCode128 MyBarcode=BarcodeCode128::construct();



    ;

BarcodeImage = new Image();

BarcodeBitmap = new System.Drawing.Bitmap(dx,dy);
BarcodeGraphics = System.Drawing.Graphics::FromImage(BarcodeBitmap);
//BarcodeGraphics.set_PixelOffsetMode(5);
barcodetxt="12123456789012omar98";
MyBarCode.string(true,barcodetxt);
MyBarCode.encode();
barcodetxt=MyBarCode.barcodeStr();

// clear canvas
DrawBrush = System.Drawing.Brushes::get_White();
BarcodeGraphics.FillRectangle(DrawBrush,0,0,any2int(dx),any2int(dy));

// set barcode text
TxtBrush = System.Drawing.Brushes::get_Black();
TxtPen = new System.Drawing.Pen(TxtBrush);

// set text alignment
StringFormat = new System.Drawing.StringFormat();
StringAlignment = System.Drawing.StringAlignment::Center;
StringFormat.set_Alignment(StringAlignment);
StringFormat.set_LineAlignment(StringAlignment);

// init rotation
//BarcodeGraphics.TranslateTransform(any2int(dx),0);
//BarcodeGraphics.RotateTransform(90);

// draw text
BarcodeGraphics.DrawString(barcodetxt, BarcodeFont,TxtBrush, 0 , 0);

// transfer image to Ax

BarcodeBitmapPtr=BarcodeBitmap.GetHbitmap();
BarcodeImage.importBitmap(BarcodeBitmapPtr);


BarcodeImage.resize(dx,dy+10,InterpolationMode::InterpolationModeNearestNeighbor);
//BarcodeImage.saveImage("c:\\prueba.bmp");



return BarcodeImage.getData();
}

Mostrar Código de Barras Vertical



static container MostrarBarCodeVertical()
{
System.Drawing.Bitmap   BarcodeBitmap;
System.Drawing.Graphics BarcodeGraphics;

int     dx=30;
int     dy=300;

str     barcodetxt;
Image   BarcodeImage;

System.Drawing.Pen                TxtPen;
System.Drawing.Brush              TxtBrush;

System.Drawing.Brush              DrawBrush;

System.Drawing.StringFormat       StringFormat;
System.Drawing.StringAlignment    StringAlignment;

System.Drawing.Font BarcodeFont = new System.Drawing.Font('BC C128 Medium',22,System.Drawing.FontStyle::Regular);

Int64             BarcodeBitmapPtr;
//BarcodeCode39    MyBarcode = BarcodeCode39::construct();
BarcodeCode128 MyBarcode=BarcodeCode128::construct();

    ;

BarcodeImage = new Image();

BarcodeBitmap = new System.Drawing.Bitmap(dx,dy);
BarcodeGraphics = System.Drawing.Graphics::FromImage(BarcodeBitmap);

barcodetxt="123456789012345678901234567890";
MyBarCode.string(true,barcodetxt);
MyBarCode.encode();
barcodetxt=MyBarCode.barcodeStr();

// clear canvas
DrawBrush = System.Drawing.Brushes::get_White();
BarcodeGraphics.FillRectangle(DrawBrush,0,0,any2int(dx),any2int(dy));

// set barcode text
TxtBrush = System.Drawing.Brushes::get_Black();
TxtPen = new System.Drawing.Pen(TxtBrush);

// set text alignment
StringFormat = new System.Drawing.StringFormat();
StringAlignment = System.Drawing.StringAlignment::Center;
StringFormat.set_Alignment(StringAlignment);
StringFormat.set_LineAlignment(StringAlignment);

// init rotation
BarcodeGraphics.TranslateTransform(any2int(dx),0);
BarcodeGraphics.RotateTransform(90);
  //  BarcodeGraphics.RotateTransform(

// draw text
BarcodeGraphics.DrawString(barcodetxt, BarcodeFont,TxtBrush, 0,0);

// transfer image to Ax
BarcodeBitmapPtr=BarcodeBitmap.GetHbitmap();
BarcodeImage.importBitmap(BarcodeBitmapPtr);

BarcodeImage.resize(dx+10,dy,InterpolationMode::InterpolationModeNearestNeighbor);
//BarcodeImage.saveImage("c:\\prueba.bmp");
return BarcodeImage.getData();
}