cevap1 v2

 avatar
unknown
plain_text
3 years ago
844 B
2
Indexable
% product entry program

pCode = input("Please enter the product code: ");
purPrice = input("Please enter the purchase price: ");
amount = input("Please enter the product amount: ");
profitRate = input("Please enter the product profit rate: ");
vatRat = input("Please enter the VAT Rate: ");

checkforfile=exist(strcat(pwd,'\','products.xls'),'file');
if checkforfile==0
    header = {'Product Code', 'Purchase Price' 'Amount' , 'Profit Rate', 'VAT Rate'};
    xlswrite('products',header,'shProducts','A1');
    N=0;
else
    N=size(xlsread('products','shProducts'),1);
end

newCode = {pCode};
newVals = {purPrice, amount, profitRate, vatRat};

AA=strcat('A',num2str(N+2));
BB=strcat('B',num2str(N+2));
xlswrite('products',newCode,'shProducts',AA);
xlswrite('products',newVals,'shProducts',BB);

sum = purPrice*profitRate*vatRat; %satis fiyati