Pages

Sunday, 31 December 2017

Tuesday, 26 December 2017

Tracking Number Generation Process

$trackingPrefix = "PI" . date("dmY");
$processTypeId = 1;
$updatePurchaseTrackingNo = DB::statement("update  ins_purchase_invoice, ins_purchase_invoice as table2
SET ins_purchase_invoice.tracking_no=(
   select concat('$trackingPrefix',
    LPAD( IFNULL(MAX(SUBSTR(table2.tracking_no,-4,4) )+1,0),4,'0')
                  ) as tracking_no
   from (select * from ins_purchase_invoice ) as table2
   where table2.id !=  $purchaseData->id
and table2.tracking_no like '$trackingPrefix%'
   )
where ins_purchase_invoice.id = $purchaseData->id and table2.id = $purchaseData->id");

2, 15, 41, 80, 132, 197, 275, 366, 470, 587….?

var n=10,s=2; for(i=1; i<=n; i++){ console.log(s); s+= 13*i; }

1, 3, 8, 15, 27, 50, 92, 169, 311….?

var a=1,b=3,c=4,n=10,i=0,sum=0;

console.log(a);
console.log(b);

for(i=4;i<=n;i++){
  sum = a+b+c;
  console.log(sum);
 
  a=b;
  b=c;
  c=sum;
}

1, 3, 6, 10, 15, 21,............ what will be the 10th element?

for(i=1,j=0; i<=10; i++){ j=i+j; console.log(j); }

5, 11, 19, 29, What will be the next number?

for(i=6,j=5; i<=12; i+=2){ console.log(j); j= j+i; }